Libraries.Language.Types.Text Documentation
The Text class is the object representation of the primitive type text.
Example Code
class Main
action Main
text name = "melissa"
Text result = test(name)
end
action test(Text value) returns Text
return value
end
end
Inherits from: Libraries.Language.Object
Summary
Actions Summary Table
Actions | Description |
---|---|
Compare(Libraries.Language.Object object) | This action compares two object values and returns an integer. |
CompareIgnoringCase(Libraries.Language.Object object) | This action compares two object values (ignoring case) and returns a CompareResult. |
Contains(text val) | This action returns true if the Text value contains the text from the parameter or if the parameter is a substring in the text variable. |
EndsWith(text suffix) | This action returns true if the Text value ends with the given suffix. |
Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their values. |
EqualsIgnoringCase(Libraries.Language.Object object) | This action determines if two objects are equal based on their values(the case is ignored). |
GetCarriageReturn() | This action gets the carriage return text value. |
GetCharacter(integer index) | This action gets the character specified by the given index and returns it. |
GetDoubleQuote() | This action gets the double quote text value. |
GetHashCode() | This action gets the hash code for an object. |
GetLineFeed() | This action gets the line feed text value. |
GetSize() | This action returns the length of the text object. |
GetSubtext(integer startIndex, integer endIndex) | This action returns a substring of the text object. |
GetSubtext(integer startIndex) | This action gets a subtext value between the given start index and the end. |
GetTab() | This action gets the tab text value. |
GetUnicodeInteger(integer index) | This action gets a unicode symbol integer value. |
GetUnicodeValue(integer twosCompliment) | This action gets a unicode symbol text value. |
GetValue() | This action gets the value from the text object. |
IndexOf(text subText, integer index) | This action returns the index location of the first occurrence of the sub-text, starting from the given index location. |
IndexOf(text subText) | This action returns the index location of the first occurrence of the sub-text. |
IsEmpty() | This action returns true if the text is empty and false if it contains any value. |
ParseBoolean() | This action parses a text value and translates it into a boolean if the text value is a valid boolean value. |
ParseInteger() | This action parses a text value and translates it into an integer if the text value is a valid integer value. |
ParseNumber() | This action parses a text value and translates it into a number if the text value is a valid number value. |
Replace(text old, text replacement) | This action replaces a specific subtext with a new value. |
SetValue(text i) | This action sets the value of the text object. |
Split(text delimiter) | This action splits the string based on the given non-empty delimiter. |
Split(text delimiter, boolean include) | This action splits the string based on the given non-empty delimiter. |
SplitIntoLines() | This action splits a text values into lines and returns them in an array. |
StartsWith(text prefix) | This action returns true if the Text value starts with the given suffix. |
ToLowerCase() | This action converts a text value to all lower case. |
ToUpperCase() | This action converts a text value to all upper case. |
Trim() | This action trims the white space from the beginning and end of the text value. |
Actions Documentation
Compare(Libraries.Language.Object object)
This action compares two object values and returns an integer. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.
Example Code
Text o
Text t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Comprare result, Smaller, Equal, or Larger.
CompareIgnoringCase(Libraries.Language.Object object)
This action compares two object values (ignoring case) and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.
Example Code
use Libraries.Language.Support.CompareResult
Text o
Text t
integer result = o:CompareIgnoringCase(t) //1 (larger), 0 (equal), or -1 (smaller)
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Comprare result, Smaller, Equal, or Larger.
Contains(text val)
This action returns true if the Text value contains the text from the parameter or if the parameter is a substring in the text variable.
Example Code
Text a
a:SetValue("hello ")
boolean result = a:Contains("lo")
Parameters
Return
boolean: True if the text contains a substring passed to the action.
EndsWith(text suffix)
This action returns true if the Text value ends with the given suffix.
Example Code
Text a
a:SetValue("hello ")
boolean result = a:EndsWith("lo")
Parameters
- text suffix: The value to check for a substring.
Return
boolean: True if the text ends with the given suffix.
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their values.
Example Code
Text o
Text t
boolean result = o:Equals(t)
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the values are equal and false if they are not equal.
EqualsIgnoringCase(Libraries.Language.Object object)
This action determines if two objects are equal based on their values(the case is ignored).
Example Code
Text o
Text t
boolean result = o:EqualsIgnoringCase(t)
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the values are equal and false if they are not equal.
GetCarriageReturn()
This action gets the carriage return text value. This allows a carriage return to be added to a text variable without using the literal value.
Example Code
text a = "hello world"
a = a + a:GetCarriageReturn() + "My name is"
output a
Return
text: The carriage return text value.
GetCharacter(integer index)
This action gets the character specified by the given index and returns it.
Example Code
Text a
a:SetValue("abcd")
output a:GetCharacter(0)
Parameters
- integer index: The index to get. Must be greater than or equal to zero.
Return
text: the character at the specified index
GetDoubleQuote()
This action gets the double quote text value. This allows a double quote to be added to a text variable without using the literal value.
Example Code
text a = "hello world"
a = a + a:GetDoubleQuote() + "My name is" + a:GetDoubleQuote()
output a
Return
text: The double quote text value.
GetHashCode()
This action gets the hash code for an object. In this case, GetHashCode is overriden to be equivalent to the hash code of its containing object, value.
Example Code
Object o
integer hash = o:GetHashCode()
Return
integer: The integer hash code of the object.
GetLineFeed()
This action gets the line feed text value. This allows a line feed to be added to a text variable without using the literal value.
Example Code
text a = "hello world"
a = a + a:GetLineFeed() + "My name is"
output a
Return
text: The line feed text value.
GetSize()
This action returns the length of the text object.
Example Code
Text a
a:SetValue("X")
output a:GetSize()
Return
integer: the length of the text object.
GetSubtext(integer startIndex, integer endIndex)
This action returns a substring of the text object.
Example Code
use Libraries.Language.Types.Text
Text a
a:SetValue("hello world")
output a:GetSubtext(0, 5)
Parameters
- integer startIndex: The starting index
- integer endIndex: The ending index
Return
text: The substring
GetSubtext(integer startIndex)
This action gets a subtext value between the given start index and the end. This includes the value at the start index.
Example Code
use Libraries.Language.Types.Text
Text a
a:SetValue("hello ")
text result = a:GetSubtext(1)
Parameters
- integer startIndex: The start of the subtext.
Return
text: The subtext from the text.
GetTab()
This action gets the tab text value. This allows a tab to be added to a text variable without using the literal value.
Example Code
text a = "hello world"
a = a + a:GetTab() + "My name is"
output a
Return
text: The tab text value.
GetUnicodeInteger(integer index)
This action gets a unicode symbol integer value. This allows any unicode symbol to be converted from text to the actual integer.
Example Code
text a = "hello world�?"
output "h as a unicode integer value is: " + a:GetUnicodeInteger(0)
Parameters
Return
integer: The unicode symbol's integer value
GetUnicodeValue(integer twosCompliment)
This action gets a unicode symbol text value. This allows any unicode symbol to be added to a text variable without using the literal value.
Example Code
text a = "hello world"
a = a + a:GetCarriageReturn() + "My name is" + a:GetUnicodeValue(2318)
output a
Parameters
- integer twosCompliment: the twos compliments value associated with each unicode symbol.
Return
text: The unicode symbol's text value.
GetValue()
This action gets the value from the text object.
Example Code
Text name
text result = name:GetValue()
Return
text: The value of the object.
IndexOf(text subText, integer index)
This action returns the index location of the first occurrence of the sub-text, starting from the given index location.
Example Code
Text a
a:SetValue("hello ")
integer result = a:IndexOf("l", 3)
Parameters
- text subText: The value to check for an index.
- integer index: The index to start searching for the sub-text
Return
integer: The index location of the first occurrence of the sub-text.
IndexOf(text subText)
This action returns the index location of the first occurrence of the sub-text.
Example Code
Text a
a:SetValue("hello ")
integer result = a:IndexOf("o")
Parameters
- text subText: The value to check for an index.
Return
integer: The index location of the sub-text.
IsEmpty()
This action returns true if the text is empty and false if it contains any value.
Example Code
Text a
a:SetValue("hello ")
boolean result = a:IsEmpty()
Return
boolean: True if the text is empty.
ParseBoolean()
This action parses a text value and translates it into a boolean if the text value is a valid boolean value. If the text value is not a boolean then the user will be alerted by an Error.
Example Code
text a = "true"
boolean result = a:ParseBoolean()
Return
boolean: The boolean value contained in the text value.
ParseInteger()
This action parses a text value and translates it into an integer if the text value is a valid integer value. If the text value is not an integer then the user will be alerted by an Error.
Example Code
text a = "12"
integer result = a:ParseInteger()
Return
integer: The integer value contained in the text value.
ParseNumber()
This action parses a text value and translates it into a number if the text value is a valid number value. If the text value is not a number then the user will be alerted by an Error.
Example Code
text a = "12.5"
number result = a:ParseNumber()
Return
number: The number value contained in the text value.
Replace(text old, text replacement)
This action replaces a specific subtext with a new value.
Example Code
Text a
a:SetValue("hello ")
text result = a:Replace("l", "z")
Parameters
- text old: The subtext to be replaced.
Return
text: The modified text after replacing all occurrence of the old subtext.
SetValue(text i)
This action sets the value of the text object.
Example Code
Text name
name:SetValue("Melissa")
Parameters
- text i: The text value.
Split(text delimiter)
This action splits the string based on the given non-empty delimiter. The delimiter can be of any length. The string will be split by the given delimiter and an array of text objects will be returned, without the delimiter.
Example Code
use Libraries.Language.Types.Text
use Libraries.Containers.Array
Text a
a:SetValue("hello world")
Array<Text> values = a:Split("l")
Parameters
- text delimiter: The non-empty delimiter to use.
Return
Libraries.Containers.Array: An array of text objects corresponding to the splits by the delimiter.
Split(text delimiter, boolean include)
This action splits the string based on the given non-empty delimiter. The delimiter can be of any length. The string will be split by the given delimiter and an array of text objects will be returned, without the delimiter.
Example Code
use Libraries.Language.Types.Text
use Libraries.Containers.Array
Text a
a:SetValue("hello world")
Array<Text> values = a:Split("l")
Parameters
- text delimiter: The non-empty delimiter to use.
- boolean include: Include any trailing values after the delimiter, including the empty string.
Return
Libraries.Containers.Array: An array of text objects corresponding to the splits by the delimiter.
SplitIntoLines()
This action splits a text values into lines and returns them in an array.
Example Code
use Libraries.System.File
use Libraries.Containers.Array
use Libraries.Containers.Iterator
File file
file:SetAbsolutePath("Some/File.txt")
text value = file:Read()
Array<text> lines = value:SplitIntoLines()
Iterator<text> iterator = lines:GetIterator()
repeat while iterator:HasNext()
text value1 = iterator:Next()
output value1
end
Return
Libraries.Containers.Array: An array that contains each line.
StartsWith(text prefix)
This action returns true if the Text value starts with the given suffix.
Example Code
Text a
a:SetValue("hello ")
boolean result = a:StartsWith("h")
Parameters
- text prefix: The value to check for a substring.
Return
boolean: True if the text starts with a given prefix.
ToLowerCase()
This action converts a text value to all lower case.
Example Code
Text a
a:SetValue("HeLlo ")
text result = a:ToLowerCase()
Return
text: The text with all lower case characters.
ToUpperCase()
This action converts a text value to all upper case.
Example Code
Text a
a:SetValue("HeLlo ")
text result = a:ToUpperCase()
Return
text: The text with all upper case characters.
Trim()
This action trims the white space from the beginning and end of the text value.
Example Code
Text a
a:SetValue(" hello ")
text result = a:Trim()
Return
text: The text that has been trimmed of white space from the beginning and end of the text value.