String
Immutable UTF-8 string type with text manipulation methods.
xxml
Language::CoreMethods
| Method | Parameters | Returns | Description |
|---|---|---|---|
| Constructor | — | String^ | Create empty string |
| Constructor | literal: string | String^ | Create from literal |
| length | — | Integer^ | Character count |
| charAt | index: Integer^ | String^ | Get character at index |
| append | other: String^ | String^ | Concatenate strings |
| substring | start: Integer^, end: Integer^ | String^ | Extract substring |
| indexOf | substr: String^ | Integer^ | Find substring (-1 if not found) |
| contains | substr: String^ | Bool^ | Check if contains |
| startsWith | prefix: String^ | Bool^ | Check prefix |
| endsWith | suffix: String^ | Bool^ | Check suffix |
| toUpperCase | — | String^ | Convert to uppercase |
| toLowerCase | — | String^ | Convert to lowercase |
| trim | — | String^ | Remove whitespace |
| replace | old: String^, new: String^ | String^ | Replace occurrences |
| split | delimiter: String^ | List<String>^ | Split into list |
| equals | other: String^ | Bool^ | Equality check |
| isEmpty | — | Bool^ | Check if empty |
| toInteger | — | Integer^ | Parse as integer |
Examples
String Manipulation
xxml
Instantiate String^ As <greeting> = String::Constructor("Hello, World!");
Instantiate Integer^ As <len> = greeting.length(); // 13
Instantiate String^ As <upper> = greeting.toUpperCase(); // "HELLO, WORLD!"
Instantiate String^ As <sub> = greeting.substring(Integer::Constructor(0), Integer::Constructor(5)); // "Hello"
Instantiate Bool^ As <hasWorld> = greeting.contains(String::Constructor("World")); // true