Returns the width of the string. Only meaningful for single byte (latin) characters. Each byte of a multibyte (non-latin) character is looked up individually and falls back to the width of a space, so the result for non-latin text is an approximation rather than a true width.
public function texttag.center(vec3 pos, string message, real size) returns texttagpublic function createCenteredTexttag(vec3 pos, string message, real size) returns texttagpublic function string.getWidth() returns intpublic function char(string s) returns charpublic function char.toString() returns stringpublic function char.toInt() returns intpublic function char.getWidth() returns intpublic function string.toChar() returns charpublic function string.toCharList() returns LinkedList<char>Splits the string into chars. Only valid for single byte (latin) characters, multibyte characters are split into their individual bytes.
public function int.toChar() returns charpublic function charToIndex(char c) returns intpublic function charFromIndex(int index) returns charpublic function string.split(string splitBy) returns LinkedList<string>Splits the string by another string “this..is..an..example” split by the string “..” splits into a list containing four strings [“this”, “is”, “an”, “example”] An empty delimiter returns the original string as one field.
public function string.splitToArray(string delimiter) returns ArrayList<string>Splits into specialized contiguous storage, preserving empty and trailing fields. An empty delimiter returns the original string as one field. The caller owns the list.
public function string.reduce(string reduced) returns stringReplaces consecutive repeats of the same string with a single instance Turns “strstr” into “str”
public function string.reduce() returns stringReplaces consecutive repeats of the whitespace character with a single instance Turns “ “ into “ “
public function string.forEachIn(string delim, ForStringSplitCallback cb)Custom Function which can split strings and runs callback for each string. It can run even with no delimiter present (with single element). Example usage: “H001,H002”.forEachIn(“,”) -> doSomething()
public function string.isNumber() returns boolChecks whether a string is a decimal number: an optional leading “-“, at least one digit, and at most one decimal point. “”, “-“, “.” and “-.” are not numbers.
public function string.isValidDescription() returns boolChecks whether a string is valid in terms of max WC3 string length for various usages (Ability Description, Quest Description,…).
public function string.replaceChars(string charset, string replacementChar) returns stringReplaces all occurences of any character from given charlist by a given replacement string. Single pass: replacement text is never scanned again, so “ab”.replaceChars(“ab”, “ba”) is “baba”.