Home

String

Resizeable Unicode string class that supports typical string operations.

Implements: Compare

Operations

New

Default constructor

New()

Copy constructor

New(string:String)
Parameters
NameTypeDescription
stringStringstring to be copied

Copy constructor

New(array:Char[])
Parameters
NameTypeDescription
arrayChar[]array to be copied

Copy constructor

New(array:Char[], offset:Int, max:Int)
Parameters
NameTypeDescription
arrayChar[]array to be copied
offsetIntoffset array index offset
maxIntoffset max max number of characters to copy

Copy constructor

New(array:Byte[])
Parameters
NameTypeDescription
arrayByte[]array to be copied

Copy constructor

New(array:Byte[], offset:Int, max:Int)
Parameters
NameTypeDescription
arrayByte[]array to be copied
offsetIntoffset array index offset
maxIntmax number of characters to copy

Append

Appends a boolean value

method : public : native : Append(b:Bool) ~ Nil
Parameters
NameTypeDescription
bBoolboolean value

Appends a integer value

method : public : native : Append(i:Int) ~ Nil
Parameters
NameTypeDescription
iIntinteger value

Appends a float value

method : public : native : Append(f:Float) ~ Nil
Parameters
NameTypeDescription
fFloatfloat value

Appends a string

method : public : native : Append(str:String) ~ Nil
Parameters
NameTypeDescription
strStringstring object

Appends a character array

method : public : native : Append(array:Char[]) ~ Nil
Parameters
NameTypeDescription
arrayChar[]character array

Appends a portion of character array

method : public : native : Append(array:Char[], offset:Int, max:Int) ~ Nil
Parameters
NameTypeDescription
arrayChar[]array to be copied
offsetIntoffset array index offset
maxIntmax number of characters to copy

Appends a character array

method : public : native : Append(array:Byte[]) ~ Nil
Parameters
NameTypeDescription
arrayByte[]array to be copied

Appends a portion of byte array

method : public : native : Append(array:Byte[], offset:Int, max:Int) ~ Nil
Parameters
NameTypeDescription
arrayByte[]array to be copied
offsetIntoffset array index offset
maxIntmax number of bytes to copy

Appends a character

method : public : native : Append(c:Char) ~ Nil
Parameters
NameTypeDescription
cCharcharacter to append

Appends a byte

method : public : native : Append(c:Byte) ~ Nil
Parameters
NameTypeDescription
cBytebyte to append

Compare

Compares two objects

method : public : Compare(rhs:Compare) ~ Int
Parameters
NameTypeDescription
rhsComparecompare object

Return
TypeDescription
Int0 if equal, -1 if right-hand side i greater, 1 if left-hand side is greater

Delete

Deletes the character at the given index

method : public : native : Delete(index:Int) ~ Bool
Parameters
NameTypeDescription
indexIntdelete index

Return
TypeDescription
Booltrue if deleted, false otherwise

Deletes the characters at the given range

method : public : native : Delete(start:Int, end:Int) ~ Bool
Parameters
NameTypeDescription
startIntstart index
endIntend index

Return
TypeDescription
Booltrue if deleted, false otherwise

EndsWith

Checks if the string ends with the given character

method : public : native : EndsWith(c:Char) ~ Bool
Parameters
NameTypeDescription
cCharcharacter to compare

Return
TypeDescription
Booltrue if ends with character, false otherwise

Checks if the string ends with the given character

method : public : native : EndsWith(s:String) ~ Bool
Parameters
NameTypeDescription
sStringstring to check for

Return
TypeDescription
Booltrue if ends with character, false otherwise

Equals

Compares two strings

method : public : Equals(rhs:String) ~ Bool
Parameters
NameTypeDescription
rhsStringstring to compare

Return
TypeDescription
Bool0 if equal, -1 if right-hand side i greater, 1 if left-hand side is greater

Error

Print an error string

method : public : native : Error() ~ Nil

ErrorLine

Print an error string with a newline

method : public : native : ErrorLine() ~ Nil

Find

Searches for the first occurrence of a character

method : public : Find(char:Char) ~ Int
Parameters
NameTypeDescription
charCharcharacter to search for

Return
TypeDescription
Intindex of first occurrence, -1 otherwise

Searches for the first occurrence of a character

method : public : native : Find(offset:Int, char:Char) ~ Int
Parameters
NameTypeDescription
offsetIntsearch offset
charCharcharacter to search for

Return
TypeDescription
Intindex of first occurrence, -1 otherwise

Searches for the first occurrence of a string

method : public : Find(find:String) ~ Int
Parameters
NameTypeDescription
findStringstring to search for

Return
TypeDescription
Intindex of first occurrence, -1 otherwise

Searches for the first occurrence of a string

method : public : native : Find(offset:Int, find:String) ~ Int
Parameters
NameTypeDescription
offsetIntsearch index offset
findStringstring to search for

Return
TypeDescription
Intindex of first occurrence, -1 otherwise

FindAll

Searches for all occurrences of a string

method : public : FindAll(find:String) ~ Int[]
Parameters
NameTypeDescription
findStringstring to search for

Return
TypeDescription
Int[]an array of indexes

FindLast

Searches for the last occurrence of a character

method : public : FindLast(char:Char) ~ Int
Parameters
NameTypeDescription
charCharcharacter to search for

Return
TypeDescription
Intindex of last occurrence, -1 otherwise

Searches for the last occurrence of a character

method : public : native : FindLast(offset:Int, char:Char) ~ Int
Parameters
NameTypeDescription
offsetIntsearch offset
charCharcharacter to search for

Return
TypeDescription
Intindex of last occurrence, -1 otherwise

Get

Returns character at the given index

method : public : native : Get(index:Int) ~ Char
Parameters
NameTypeDescription
indexIntindex offset

Return
TypeDescription
Charcharacter at index

Has

Searches for the first occurrence of a character

method : public : Has(char:Char) ~ Bool
Parameters
NameTypeDescription
charCharcharacter to search for

Return
TypeDescription
Booltrue of found, false otherwise

Searches for the first occurrence of a character

method : public : Has(offset:Int, char:Char) ~ Bool
Parameters
NameTypeDescription
offsetIntsearch offset
charCharcharacter to search for

Return
TypeDescription
Booltrue of found, false otherwise

Searches for the first occurrence of a character

method : public : Has(str:String) ~ Bool
Parameters
NameTypeDescription
strStringstring to search for

Return
TypeDescription
Booltrue of found, false otherwise

Searches for the first occurrence of a character

method : public : Has(offset:Int, str:String) ~ Bool
Parameters
NameTypeDescription
offsetIntsearch offset
strStringstring to search for

Return
TypeDescription
Booltrue of found, false otherwise

HashID

Returns a unique hash ID for a given string sequence

method : public : native : HashID() ~ Int
Return
TypeDescription
Inthash ID

Insert

Insert inserts a string

method : public : native : Insert(index:Int, s:String) ~ Bool
Parameters
NameTypeDescription
indexIntinsert offset
sStringstring to insert

Return
TypeDescription
Booltrue if inserted, false otherwise

IsEmpty

Returns rather the string is empty

method : public : native : IsEmpty() ~ Bool
Return
TypeDescription
Booltrue if empty, false otherwise

Pop

Pops the last character from the string reducing the size by 1

method : public : native : Pop() ~ Char
Return
TypeDescription
Charlast character of the string

Print

Print a string

method : public : native : Print() ~ Nil

PrintLine

Print a string with a newline

method : public : native : PrintLine() ~ Nil

Replace

Replaces the first occurrence the search string

method : public : native : Replace(find:String, replace:String) ~ String
Parameters
NameTypeDescription
findStringstring to search for
replaceStringstring to replace with

Return
TypeDescription
Stringnew string instance

ReplaceAll

Replaces all occurrences the search string

method : public : native : ReplaceAll(find:String, replace:String) ~ String
Parameters
NameTypeDescription
findStringstring to search for
replaceStringstring to replace with

Return
TypeDescription
Stringnew string instance

Reverse

Reverses a string

method : public : native : Reverse() ~ String
Return
TypeDescription
Stringreversed string

Size

Return the size of the string

method : public : native : Size() ~ Int
Return
TypeDescription
Intsize of the string

Split

Splits a string based upon delimiter

method : public : native : Split(delim:String) ~ String[]
Parameters
NameTypeDescription
delimStringsplitting delimiter

Return
TypeDescription
String[]array of split sub strings

StartsWith

Checks if the string starts with the given character

method : public : native : StartsWith(c:Char) ~ Bool
Parameters
NameTypeDescription
cCharcharacter to compare

Return
TypeDescription
Booltrue if starts with character, false otherwise

Checks if the string starts with the given string

method : public : native : StartsWith(s:String) ~ Bool
Parameters
NameTypeDescription
sStringstring to check for

Return
TypeDescription
Booltrue if starts with string, false otherwise

SubString

Creates a sub-string

method : public : SubString(length:Int) ~ String
Parameters
NameTypeDescription
lengthIntmax length of sub-string

Return
TypeDescription
Stringsub-string

Creates a sub-string

method : public : native : SubString(offset:Int, length:Int) ~ String
Parameters
NameTypeDescription
offsetIntindex offset
lengthIntmax length of sub-string

Return
TypeDescription
Stringsub-string

ToByteArray

Returns a byte array representation of the String

method : public : native : ToByteArray() ~ Byte[]
Return
TypeDescription
Byte[]byte array

ToCharArray

Returns a character array representation of the String

method : public : native : ToCharArray() ~ Char[]
Return
TypeDescription
Char[]character array

ToFloat

Parses the string into a float

method : public : ToFloat() ~ Float
Return
TypeDescription
Floatfloat value

ToInt

Parses the string into an integer

method : public : ToInt() ~ Int
Return
TypeDescription
Intinteger value

Parses the string into an integer

method : public : ToInt(base:Int) ~ Int
Parameters
NameTypeDescription
baseIntbase radix

Return
TypeDescription
Intinteger value

ToLower

Transforms a to lower case

method : public : native : ToLower() ~ String
Return
TypeDescription
Stringlower case string

ToUpper

Transforms a to upper case

method : public : native : ToUpper() ~ String
Return
TypeDescription
Stringupper case string

Trim

Removes all leading and ending white space

method : public : native : Trim() ~ String
Return
TypeDescription
Stringtrimmed string