v2025.6.2
All Bundles

String

Resizeable Unicode character string

# build and print string
cities_str := "\t\tNapa,";
cities_str += "Fremont,";
cities_str += "Alameda,";
cities_str += "Berkeley,";
cities_str += "Fremont,";
cities_str += "San Carlos,";
cities_str += "Milpitas,  ";
cities_str->PrintLine();

# show the string size
cities_str->Size()->PrintLine();

# trim string
cities_str := cities_str->Trim();
cities_str->Size()->PrintLine();

# replace city
cities_str := cities_str->Replace("San Carlos", "Oakland");
cities_str->PrintLine();

# create a substring
start := cities_str->Find("Berkeley");
if(<>start->IsNeg()) {
   end := cities_str->Find(start, ',');
   if(<>end->IsNeg()) {
      city := cities_str->SubString(start, end - start);
      "They city found was {$city}"->PrintLine();
   }
};

# remove ending comma
cities_str->Pop();

# split string and print values
cities := cities_str->Split(',');
cities->Size()->PrintLine();

# iterate over cities
each(city := cities) {
   city->PrintLine();
};

# iterate over cities with an index
each(i : cities) {
   city := cities[i];
   "{$i}: |{$city}|"->PrintLine();
};

Operations

Append

Appends a boolean value

method : public : Append(flag:Bool) ~ Nil

Parameters

NameTypeDescription
flagBoolboolean value

Append

Appends a integer value

method : public : Append(i:Int) ~ Nil

Parameters

NameTypeDescription
iIntinteger value

Append

Appends a float value

method : public : Append(f:Float) ~ Nil

Parameters

NameTypeDescription
fFloatfloat value

Append

Appends a string

method : public : Append(str:String) ~ Nil

Parameters

NameTypeDescription
strStringstring object

Append

Appends a character array

method : public : Append(array:Char[]) ~ Nil

Parameters

NameTypeDescription
arrayCharcharacter array

Append

Appends a portion of character array

method : public : native : Append(array:Char[], offset:Int, length:Int) ~ Nil

Parameters

NameTypeDescription
arrayChararray to be copied
offsetIntoffset array index offset
lengthIntnumber of characters to copy

Append

Appends a character array

method : public : native : Append(array:Byte[]) ~ Nil

Parameters

NameTypeDescription
arrayBytearray to be copied

Append

Appends a portion of byte array

method : public : native : Append(array:Byte[], offset:Int, length:Int) ~ Nil

Parameters

NameTypeDescription
arrayBytearray to be copied
offsetIntoffset array index offset
lengthIntnumber of bytes to copy

Append

Appends a character

method : public : Append(c:Char) ~ Nil

Parameters

NameTypeDescription
cCharcharacter to append

Append

Appends a byte

method : public : Append(c:Byte) ~ Nil

Parameters

NameTypeDescription
cBytebyte to append

Capacity

Gets the current string's storage capacity. That is the number of characters the string will hold before it is resized for growth.

method : public : Capacity() ~ Int

Return

TypeDescription
Intstring capacity

Clear

Clears string

method : public : Clear() ~ Nil

Clone

Clones the object instance

method : public : Clone() ~ System.String

Return

TypeDescription
Stringcloned the object instance

Compare

Compares two objects

method : public : Compare(rhs:System.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

Compress

Compresses a string removing unused space.

method : public : Compress() ~ Nil

Copy

Creates a new instance of the string

method : public : Copy() ~ String

Return

TypeDescription
Stringnew string instance

Count

Counts the occurrence of a character

method : public : Count(char:Char) ~ Int

Parameters

NameTypeDescription
charCharcharacter to search for

Return

TypeDescription
Intcount of occurrences or -1 if not found

Count

Counts the occurrence of a character

method : public : native : Count(offset:Int, char:Char) ~ Int

Parameters

NameTypeDescription
offsetIntsearch offset
charCharcharacter to search for

Return

TypeDescription
Intcount of occurrences or -1 if not found

Delete

Deletes the character at the given index

method : public : Delete(offset:Int) ~ Bool

Parameters

NameTypeDescription
offsetIntoffset index

Return

TypeDescription
Booltrue if deleted, false otherwise

Delete

Deletes the characters at the given range

method : public : Delete(offset:Int, length:Int) ~ Bool

Parameters

NameTypeDescription
offsetIntoffset index
lengthIntlength

Return

TypeDescription
Booltrue if deleted, false otherwise

EndsWith

Checks if the string ends with the given character

method : public : EndsWith(char:Char) ~ Bool

Parameters

NameTypeDescription
charCharcharacter to compare

Return

TypeDescription
Booltrue if ends with character, false otherwise

EndsWith

Checks if the string ends with the given string

method : public : native : EndsWith(string:String) ~ Bool

Parameters

NameTypeDescription
stringStringstring to check for

Return

TypeDescription
Booltrue if ends with string, false otherwise

Equals

Compares two strings

method : public : native : Equals(rhs:String) ~ Bool

Parameters

NameTypeDescription
rhsStringstring to compare

Return

TypeDescription
Booltrue if equal, false otherwise

Equals

Compares a string to an array of values

method : public : Equals(rhs:String[]) ~ Bool

Parameters

NameTypeDescription
rhsStringarray of values to compare

Return

TypeDescription
Booltrue if at least one match, false otherwise

EqualsIgnoreCase

Compares two strings, ignoring the case

method : public : native : EqualsIgnoreCase(rhs:String) ~ Bool

Parameters

NameTypeDescription
rhsStringstring to compare

Return

TypeDescription
Booltrue if equal, false otherwise

EqualsIgnoreCase

Compares a string to an array of values, ignoring case

method : public : EqualsIgnoreCase(rhs:String[]) ~ Bool

Parameters

NameTypeDescription
rhsStringarray of values to compare

Return

TypeDescription
Booltrue if at least one match, false otherwise

Error

Print an error string

method : public : Error() ~ Nil

ErrorLine

Print an error string with a newline

method : public : 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

Find

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

Find

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

Find

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
Intan 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

FindLast

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

First

Returns the first character

method : public : First() ~ Char

Return

TypeDescription
Charfirst character

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

Has

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

Has

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

Has

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 : HashID() ~ Int

Return

TypeDescription
Inthash ID

Insert

Insert inserts a character

method : public : Insert(index:Int, char:Char) ~ Bool

Parameters

NameTypeDescription
indexIntinsert offset
charCharcharacter to insert

Return

TypeDescription
Booltrue if inserted, false otherwise

Insert

Insert inserts a string

method : public : Insert(index:Int, string:String) ~ Bool

Parameters

NameTypeDescription
indexIntinsert offset
stringStringstring to insert

Return

TypeDescription
Booltrue if inserted, false otherwise

Insert

Insert inserts a string

method : public : Insert(index:Int, buffer:Char[]) ~ Bool

Parameters

NameTypeDescription
indexIntinsert offset
bufferCharbuffer to insert

Return

TypeDescription
Booltrue if inserted, false otherwise

IsEmpty

Returns rather the string is empty

method : public : IsEmpty() ~ Bool

Return

TypeDescription
Booltrue if empty, false otherwise

IsFloat

Checks to see if the string can be represented as an float

method : public : IsFloat() ~ Bool

Return

TypeDescription
Booltrue if the string can be represented as an float, false otherwise

IsInt

Checks to see if the string can be represented as an interger

method : public : native : IsInt() ~ Bool

Return

TypeDescription
Booltrue if the string can be represented as an interger, false otherwise

Justify

Justify if word length is then width

method : public : Justify(width:Int, is_left:Bool) ~ String

Parameters

NameTypeDescription
widthIntwidth to justify to
is_leftBoolif true, justify left, right otherwise

Return

TypeDescription
Stringpadded string

Last

Returns the last character

method : public : native : Last() ~ Char

Return

TypeDescription
Charlast character

Lines

Splits a string into lines

method : public : native : Lines() ~ String[]

Return

TypeDescription
Stringarray of lines

New

Default constructor

New()

New

Copy constructor

New(string:String)

Parameters

NameTypeDescription
stringStringstring to be copied

New

Copy constructor

New(array:Char[])

Parameters

NameTypeDescription
arrayChararray to be copied

New

Copy constructor

New(array:Char[], copy:Bool)

Parameters

NameTypeDescription
arrayChararray to be copied
copyBoolif false, use array for value for string otherwise copy values

New

Copy constructor

New(array:Char[], offset:Int, length:Int)

Parameters

NameTypeDescription
arrayChararray to be copied
offsetIntoffset array index offset
lengthIntnumber of characters to copy

New

Copy constructor

New(bytes:Byte[])

Parameters

NameTypeDescription
bytesBytearray to be copied

New

Copy constructor

New(bytes:Byte[], offset:Int, length:Int)

Parameters

NameTypeDescription
bytesBytearray to be copied
offsetIntoffset array index offset
lengthIntnumber of characters to copy

Pad

Pads a string with a character

method : public : Pad(char:Char, num:Int, is_left:Bool) ~ String

Parameters

NameTypeDescription
charCharcharacter to pad with
numIntnumber of character to pad
is_leftBoolif true, pad left, otherwise pad right

Return

TypeDescription
Stringpadded string

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 : Print() ~ Nil

PrintLine

Prints values

function : PrintLine(v:String[]) ~ Nil

Parameters

NameTypeDescription
vStringvalues to print

PrintLine

Print a string with a newline

method : public : PrintLine() ~ Nil

Remove

Removes the first occurrence the search string

method : public : Remove(find:String) ~ String

Parameters

NameTypeDescription
findStringstring to search for

Return

TypeDescription
Stringnew string instance

Remove

Removes all matching characters from a string

method : public : Remove(char:Char) ~ String

Parameters

NameTypeDescription
charCharcharacter to remove

Return

TypeDescription
Stringstring with matching characters removed

RemoveAll

Removes all occurrences the search string

method : public : RemoveAll(find:String) ~ String

Parameters

NameTypeDescription
findStringstring to search for

Return

TypeDescription
Stringnew string instance

RemoveAll

Removes all occurrences the search character

method : public : RemoveAll(find:Char) ~ String

Parameters

NameTypeDescription
findCharcharacter to search for

Return

TypeDescription
Stringnew string instance

Replace

Replaces the first occurrence the search string

method : public : 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 : ReplaceAll(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:Char, replace:Char) ~ String

Parameters

NameTypeDescription
findCharcharacter to search for
replaceCharcharacter to replace with

Return

TypeDescription
Stringnew string instance

Reverse

Reverses a string

method : public : native : Reverse() ~ String

Return

TypeDescription
Stringreversed string

Set

Sets character at the given index

method : public : Set(char:Char, index:Int) ~ Bool

Parameters

NameTypeDescription
charCharcharter to set
indexIntindex offset

Return

TypeDescription
Booltrue if successful, false otherwise

SetFloatFormat

Set floating point string format.

function : SetFloatFormat(format:Number->Format) ~ Nil

Parameters

NameTypeDescription
formatNumber->Formatfloat format

SetFloatPrecision

Set floating point string precision.

function : SetFloatPrecision(precision:Int) ~ Nil

Parameters

NameTypeDescription
precisionIntdecimal precision

SetIntFormat

Set integer string format.

function : SetIntFormat(format:Number->Format) ~ Nil

Parameters

NameTypeDescription
formatNumber->Formatinteger format

Size

Return the size of the string

method : public : 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
Stringarray of split sub strings

Split

Splits a string based upon delimiter

method : public : native : Split(delim:Char) ~ String[]

Parameters

NameTypeDescription
delimCharsplitting delimiter

Return

TypeDescription
Stringarray of split sub strings

StartsWith

Checks if the string starts with the given character

method : public : StartsWith(char:Char) ~ Bool

Parameters

NameTypeDescription
charCharcharacter to compare

Return

TypeDescription
Booltrue if starts with character, false otherwise

StartsWith

Checks if the string starts with the given string

method : public : StartsWith(string:String) ~ Bool

Parameters

NameTypeDescription
stringStringstring 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

SubString

Creates a sub-string

method : public : SubString(offset:Int, length:Int) ~ String

Parameters

NameTypeDescription
offsetIntindex offset
lengthIntmax length of sub-string

Return

TypeDescription
Stringsub-string

ToBool

Parses the string into a boolean

method : public : ToBool() ~ Bool

Return

TypeDescription
Boolboolean value

ToByteArray

Returns a byte array representation of the String

method : public : native : ToByteArray() ~ Byte[]

Return

TypeDescription
Bytebyte array

ToCharArray

Returns a character array representation of the String

method : public : ToCharArray() ~ Char[]

Return

TypeDescription
Charcharacter 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

ToInt

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

ToString

Returns string of self

method : public : ToString() ~ String

Return

TypeDescription
Stringstring of self

ToString

Formats an array of string

function : native : ToString(v:String[]) ~ String

Parameters

NameTypeDescription
vStringstring array

ToUpper

Transforms a to upper case

method : public : native : ToUpper() ~ String

Return

TypeDescription
Stringupper case string

Trim

Removes all leading and trailing white space

method : public : native : Trim() ~ String

Return

TypeDescription
Stringtrimmed string

TrimBack

Removes all trailing white space

method : public : native : TrimBack() ~ String

Return

TypeDescription
Stringtrimmed string

TrimFront

Removes all leading white space

method : public : native : TrimFront() ~ String

Return

TypeDescription
Stringtrimmed string