SplitScript reference / String
String
type
String
Stores ordinary immutable UTF-8 text in WebAssembly GC memory.
String literals, interpolation, process decoders, and timer variables all produce this same type. A decoded string owns its GC storage and is not a view into target-process memory. Decoder bounds such as utf8(64) describe the memory operation, not distinct String types.
Examples
Store owned text
let character: String = "Toree"
Capabilities
| Member | Description | Available through |
|---|---|---|
| Debug | Produces an unambiguous structural representation of a value. | |
| Display | Supports conversion to a user-facing textual representation. | |
| Equatable | Supports equality comparison. |
Operators
| Member | Description | Available through |
|---|---|---|
| == | Reports whether this value and another value are equal. | Available through Equatable |
| != | Reports whether this value and another value differ. | Available through Equatable |
Methods
| Member | Description | Available through |
|---|---|---|
| debugString | Converts the receiver to its unambiguous structural representation. | Available through Debug |
| toString | Converts the receiver to its user-facing string representation. | Available through Display |
| byteAt | Returns the raw UTF-8 byte at an offset. | |
| byteLength | Returns a string's UTF-8 byte length. | |
| charAt | Returns the Unicode character beginning at a UTF-8 byte offset. | |
| concat | Concatenates an array of strings. | |
| contains | Tests whether this string contains an exact substring. | |
| endsWith | Tests whether this string ends with an exact suffix. | |
| equalsIgnoreAsciiCase | Compares two strings while ignoring ASCII letter case. | |
| indexOf | Finds the first exact substring and returns its UTF-8 byte offset. | |
| isBlank | Reports whether this string is empty or contains only Unicode whitespace. | |
| isEmpty | Reports whether this string contains no UTF-8 bytes. | |
| join | Joins an array of strings with one separator between adjacent values. | |
| lastIndexOf | Finds the last exact substring and returns its UTF-8 byte offset. | |
| padEnd | Pads the end of this string to a minimum Unicode-scalar length. | |
| padStart | Pads the beginning of this string to a minimum Unicode-scalar length. | |
| parse | Parses this string as an inferred numeric type. | |
| replaceAll | Replaces every exact, non-overlapping occurrence of a string. | |
| slice | Extracts text between two UTF-8 byte offsets. | |
| split | Splits this string at every exact, non-overlapping delimiter. | |
| startsWith | Tests whether this string starts with an exact prefix. | |
| toAsciiLowerCase | Returns this string with ASCII uppercase letters converted to lowercase. | |
| toAsciiUpperCase | Returns this string with ASCII lowercase letters converted to uppercase. | |
| trimAsciiWhitespace | Removes ASCII whitespace from both ends of this string. |