String Text¶
Import: import system.text;
compare¶
Orders this string against other lexicographically.
is_empty¶
True when the string has no characters.
this¶
Gets the character at the specified index.
this¶
Replaces the UTF-16 code unit at index; an invalid index panics.
iterator¶
Gets an iterator for the string's characters.
substring¶
Gets a substring from start to end (O(1) slice of the parent).
index_of¶
The index of the first occurrence of target, or None.
index_of¶
The index of the first occurrence of substring sub, or None.
contains¶
True if sub occurs anywhere in this string.
starts_with¶
True if this string begins with prefix.
ends_with¶
True if this string ends with suffix.
to_lower¶
A new string with every uppercase letter lowercased.
to_upper¶
A new string with every lowercase letter uppercased.
to_lower_unicode¶
A new string with every character lowercased by the Unicode full case mapping, which can change the length ("İ" becomes "i̇"). Capital sigma becomes final sigma ς at the end of a word. The result is the same on every target and does not depend on a locale.
to_upper_unicode¶
A new string with every character uppercased by the Unicode full case mapping, which can change the length ("straße" becomes "STRASSE"). The result is the same on every target and does not depend on a locale.
graphemes¶
Splits the string into extended grapheme clusters (Unicode UAX #29), the units a reader perceives as single characters: a letter with its accents, an emoji sequence joined by zero-width joiners, or a flag. Returns an empty array for an empty string.
normalize¶
Returns the string in Unicode normalization form (UAX #15). Nfc and Nfd preserve meaning; Nfkc and Nfkd also replace compatibility characters such as fi with fi.
trim¶
A new string with leading and trailing whitespace removed.
trim_start¶
A new string with leading whitespace removed.
trim_end¶
A new string with trailing whitespace removed.
is_blank¶
True when trim() is empty.
pad_start¶
Left-pads this string with pad until width code units (no-op when pad is empty).
pad_end¶
Right-pads this string with pad until width code units (no-op when pad is empty).
last_index_of¶
The index of the last occurrence of target, or None.