|
| string | Format (string string, value values) |
| | Formats a format string according to the given format specifiers. A format specifier is a string of the form.
|
| array | Split (string string, integer delimiter) |
| | Splits a string by a delimiter.
|
| integer | CharAt (string string, integer index) |
| | Gets the 8-bit value of the character at the specified index.
|
| integer | CodepointAt (string string, integer index) |
| | Gets the codepoint value of the character at the specified index.
|
| integer | Length (string string) |
| | Gets the length of the string value.
|
| integer | Compare (string stringA, string stringB) |
| | Compares two strings lexicographically.
|
| integer | IndexOf (string string, string substring) |
| | Get the first index at which the substring occurs in the string.
|
| boolean | Contains (string string, string substring) |
| | Searches for whether a substring is within a string value.
|
| string | Substring (string string, integer startIndex, integer length) |
| | Get a string value from a portion of a larger string value.
|
| string | ToUpperCase (string string) |
| | Convert a string value to its uppercase representation.
|
| string | ToLowerCase (string string) |
| | Convert a string value to its lowercase representation.
|
| integer | LastIndexOf (string string, string substring) |
| | Get the last index at which the substring occurs in the string.
|
| integer | ParseInteger (string string, integer radix) |
| | Converts a string value to an integer value, if possible.
|
| decimal | ParseDecimal (string string) |
| | Convert a string value to a decimal value if possible.
|
| array | GetCodepoints (string string) |
| | Gets a list of UCS codepoints from UTF-8 text.
|
| string | FromCodepoints (array codepoints) |
| | Creates UTF-8 text from a list of UCS codepoints.
|
String manipulation functions.
| string String.Format |
( |
string | string, |
|
|
value | values ) |
Formats a format string according to the given format specifiers. A format specifier is a string of the form.
%[flags][width][.precision][conversion specifier]
where a conversion specifier must be one of the following:
-
d: Integers
-
f or F: Decimals
-
s: Strings
-
c: Characters
-
x or X: Hexadecimal integers
-
b or b: Binary integers
-
o: Octal integers
-
%: A literal percent sign character
Flags are optional, and must be one of the following:
-
0: Pads the value with leading zeroes. See the width sub-specifier.
-
-: Left-justifies the result. See the width sub-specifier.
-
#: Prefixes something to the value depending on the conversion specifier:
-
x or X: Prefixes the value with 0x or 0X respectively.
-
b or B: Prefixes the value with 0b or 0B respectively.
-
f: Prefixes the value with a . character.
-
o: Prefixes the value with a 0 character.
-
+: Prefixes positive numbers with a plus sign.
-
A space character: If no sign character (- or +) was written, a space character is written instead.
A width sub-specifier is used in conjunction with the flags:
-
A number: The amount of padding to add.
-
*: This functions the same as the above, but the width is given in the next argument as an Integer value.
Precision specifiers are also supported:
-
. followed by a number:
-
For Integer values, this pads the value with leading zeroes.
-
For Decimal values, this specifies the number of digits to be printed after the decimal point (which is 6 by default).
-
For String values, this is the maximum amount of characters to be printed.
-
. followed by a *: This functions the same as the above, but the precision is given in the next argument as an Integer value.
- Parameters
-
| string | The format string. |
| values | Variable arguments. |
- Returns
- Returns a string value.