The builtin type string.
The string can be any sequence of Unicode characters, including NUL.
A string cannot be modified, see varString for a mutable string.
The C implementation uses UTF-8 encoded characters.
Illegal byte sequences may appear but cause an exception for some
operations. Locating a character by index is slow, it requires going
over the string from the start, since UTF-8 is a variable width encoding.
For longer strings it is faster to use indexes on the result of toArray().
The Javascript implementation uses native strings. Illegal bytes are not
possible. Locating a character by index is fast.
Obtaining the length of the string is always fast, it does not need to
scan the bytes for a NUL byte, like in C.
|
NEW(array) @file | Create a string from the characters in array.
|
|
NEW(array, start) @file | Create a string from the characters in array starting at index start.
|
|
NEW(array, start, end) @file | Create a string from the characters in array starting at index start
and ending at index end (inclusive).
|
|
$Size()
int @public | Return the size of the string in characters.
|
|
$ToString()
string @public | Return the string itself, a no-op. Also works on a NIL.
|
|
$ToString(formatSpec)
string @public | Return a formatted version of the string.
|
|
$Compare(other)
int @public | Return -1 when other sorts after this string, zero when other is
equal to this string, and 1 when other sorts before this string.
|
|
$Equal(other)
bool @public | Return TRUE when other is equal to this string, FALSE otherwise.
|
|
$asByteString()
byteString @public | Return the string as a byteString.
|
|
$toByteString()
byteString @public | Return the string as a byteString.
|
|
$toVarString()
varString @public | Return the string converted to a varString.
|
|
$toArray()
array<nat32> @public | Return an array with the characters of the string.
|
|
$format(arguments)
string @file | Replace placeholders in the string with argument values.
|
|
$toInt()
int @public | Return the digits at the start of the string converted to a number.
|
|
$toInt(default)
int @public | Return the digits at the start of the string converted to a number.
|
|
$quotedToInt()
int @public | Return the digits at the start of the string converted to a number,
ignoring quotes.
|
|
$quotedToInt(default)
int @public | Return the digits at the start of the string converted to a number,
ignoring quotes.
|
|
$hexToInt()
int @public | Return the hex digits at the start of the string converted to a number.
|
|
$hexToInt(default)
int @public | Return the hex digits at the start of the string converted to a number.
|
|
$quotedHexToInt()
int @public | Return the hex digits at the start of the string converted to a number,
ignoring quotes.
|
|
$quotedHexToInt(default)
int @public | Return the hex digits at the start of the string converted to a number,
ignoring quotes.
|
|
$binToInt()
int @public | Return the binary digits at the start of the string converted to a
number.
|
|
$binToInt(default)
int @public | Return the binary digits at the start of the string converted to a
number.
|
|
$quotedBinToInt()
int @public | Return the binary digits at the start of the string converted to a
number, ignoring quotes.
|
|
$quotedBinToInt(default)
int @public | Return the binary digits at the start of the string converted to a
number, ignoring quotes.
|
|
$toFloat()
float @public | Return the number at the start of the string converted to a float.
|
|
$toFloat(length)
float @public | Return the number at the start of the string converted to a float.
|
|
$contains(s)
bool @public | Return TRUE if the string contains s.
|
|
$contains(re)
bool @public | Return TRUE if re matches in the string.
|
|
$find(s)
int @public | Return the lowest index where string s appears.
|
|
$find(re)
int @public | Return the lowest index where regexp re matches.
|
|
$find(c)
int @public | Return the lowest index of the character c.
|
|
$find(s, start)
int @public | Return the lowest index where the string s appears at or after start.
|
|
$find(c, start)
int @public | Return the lowest index of the character c at or after start.
|
|
$findLast(s)
int @public | Return the highest index where string s appears.
|
|
$findLast(c)
int @public | Return the highest index of the character c.
|
|
$startsWith(s)
bool @public | Return TRUE when the string starts with s.
|
|
$endsWith(s)
bool @public | Return TRUE when the string ends with s.
|
|
$hash()
nat @public | Return a number that is a hash value of the string.
|
|
$padLeft(minSize, pad)
string @public | Return the string with padding added on the left.
|
|
$padRight(minSize, pad)
string @public | Return the string with padding added on the right.
|
|
$reverse()
string @public | Return the string with all characters in reverse order.
|
|
$replace(from, to)
string @public | Replace the first occurrence of the from character with to.
|
|
$replace(from, to)
string @public | Replace the first occurrence of from with to.
|
|
$replaceAll(from, to)
string @public | Replace all occurrences of the from character with to.
|
|
$replaceAll(from, to)
string @public | Replace all occurrences of from with to.
|
|
$escape()
string @public | Double all backslashes and put a backslash before a double quote.
|
|
$toLower()
string @public | Return a copy of the string with all characters lower-cased.
|
|
$toLowerAscii()
string @public | Return a copy of the string with all ASCII characters lower-cased.
|
|
$toUpper()
string @public | Return a copy of the string with all characters upper-cased.
|
|
$toUpperAscii()
string @public | Return a copy of the string with all ASCII characters upper-cased.
|
|
$slice(start)
string @public | Return a copy of the string, starting at index start.
|
|
$slice(start, end)
string @public | Return a copy of the string, starting at index start and ending at
end, inclusive.
|
|
$sliceSize(start, length)
string @public | Return a copy of the string, starting at index start with up to
length characters.
|
|
$sliceWrap(start)
string @public | Return a copy of the string, starting at index start.
|
|
$sliceWrap(start, end)
string @public | Return a copy of the string, starting at index start and ending at
end, inclusive.
|
|
$sliceWrapSize(start, length)
string @public | Return a copy of the string, starting at index start with up to
length characters
|
|
$split()
list<string> @public | Return a list with the string split at white space.
|
|
$split(sep)
list<string> @public | Return a list with the string split into pieces, split at sep.
|
|
$splitAnyOf(charSet)
list<string> @public | Return a list with the string split at the characters in charSet.
|
|
$trim()
string @public | Return the string with leading and trailing white space removed.
|
|
$trimLeading()
string @public | Return the string with leading white space removed.
|
|
$trimTrailing()
string @public | Return the string with trailing white space removed.
|
|
|