FixUtil Documentation

Back to summary

import "util/string";

Extension functions

Note: use the string_ prefix when not using classes.

function String::substring(start: Integer): String
function String::substring(start: Integer, end: Integer): String
Returns a substring for given range (the ending is exclusive). When no ending index is provided the end of string is used.
static function String::join(array: Dynamic[], delim: String): String
Returns a string where each element of the array is converted to a string if needed and appended into a new string using a given delimiter.
function String::split(char: Integer): String[]
function String::split(char: Integer, multi: Boolean): String[]
Splits the given string by the specified character. Optionally it can split by multiple count of the character. An empty string results into an empty array.
function String::starts_with(match: String): Boolean
Returns true when the given string starts with the specified string.
function String::ends_with(match: String): Boolean
Returns true when the given string ends with the specified string.
function String::replace_char(char: Integer, replacement: Integer): String
Finds and replaces all characters and returns the result as a new string.
function String::replace_char_inplace(char: Integer, replacement: Integer)
A variant of the String::replace_char function that modifies the string in-place.
function String::replace_string(search: String, replacement: Integer): String
Finds and replaces all occurences of given string and returns the result as a new string.
function String::replace_string_inplace(search: String, replacement: String)
A variant of the String::replace_string function that modifies the string in-place.
static function String::char(char: Integer): String
Returns a new string with a single character.
function String::to_lower_case(): String
Returns a new string where each character is converted into a lower case variant (ASCII only).
function String::to_upper_case(): String
Returns a new string where each character is converted into a upper case variant (ASCII only).
function String::trim(): String
function String::trim(is_whitespace_func): String
Trims a whitespace (optionally defined by provided function) from the beginning and ending of the string. The result is returned as a new string.
function String::trim_inplace()
function String::trim_inplace(is_whitespace_func)
Variants of String::trim functions that modify the original string in-place.
function String::pad_left(len: Integer): String
function String::pad_left(len: Integer, char: Integer): String
Pads the string from the left to given length using the specified character (or space when not provided). No adjustment is done when the string is bigger. Returns the result as a new string.
function String::pad_right(len: Integer): String
function String::pad_right(len: Integer, char: Integer): String
Pads the string from the right to given length using the specified character (or space when not provided). No adjustment is done when the string is bigger. Returns the result as a new string.
function String::search_char(char: Integer): Integer
function String::search_char(char: Integer, start: Integer): Integer
function String::search_char(char: Integer, start: Integer, end: Integer): Integer
Searches for given character in a string (optionally within a range, the end is exclusive). Returns the index or -1 when the character is not found.
function String::rev_search_char(char: Integer): Integer
function String::rev_search_char(char: Integer, end: Integer): Integer
function String::rev_search_char(char: Integer, start: Integer, end: Integer): Integer
Variants of String::search_char functions that search from the end.
function String::search_multi_char(chars: String): Integer
function String::search_multi_char(chars: String, start: Integer): Integer
function String::search_multi_char(chars: String, start: Integer, end: Integer): Integer
Variants of String::search_char functions that search multiple characters.
function String::rev_search_multi_char(chars: String): Integer
function String::rev_search_multi_char(chars: String, end: Integer): Integer
function String::rev_search_multi_char(chars: String, start: Integer, end: Integer): Integer
Variants of String::search_multi_char functions that search from the end.
function String::search_string(search: String): Integer
function String::search_string(search: String, start: Integer): Integer
function String::search_string(search: String, start: Integer, end: Integer): Integer
Searches for given string in a string (optionally within a range, the end is exclusive). Returns the index or -1 when the character is not found.
function String::rev_search_string(search: String): Integer
function String::rev_search_string(search: String, end: Integer): Integer
function String::rev_search_string(search: String, start: Integer, end: Integer): Integer
Variants of String::search_string functions that search from the end.
function String::contains(search: String): Boolean
Returns whether the string contains a string.
static function String::compare(s1: String, s2: String): Integer
Returns negative value when s1 is less than s2, zero when they're equal or positive value when s1 is greater than s2.
static function String::parse_hex_int(s: String): Integer
static function String::parse_hex_int(s: String, default_value: Integer): Integer
static function String::parse_hex_int(s: String, off: Integer, len: Integer): Integer
static function String::parse_hex_int(s: String, off: Integer, len: Integer, default_value: Integer): Integer
Parses the string as a hexadecimal integer. You can optionally pass a default value to return instead of an error.
static function String::parse_long(s: String): Long
static function String::parse_long(s: String, default_value: Long): Long
static function String::parse_long(s: String, off: Integer, len: Integer): Long
static function String::parse_long(s: String, off: Integer, len: Integer, default_value: Long): Long
Parses the string as a long. You can optionally pass a default value to return instead of an error.
static function String::parse_double(s: String): Double
static function String::parse_double(s: String, default_value: Double): Double
static function String::parse_double(s: String, off: Integer, len: Integer): Double
static function String::parse_double(s: String, off: Integer, len: Integer, default_value: Double): Double
Parses the string as a double. You can optionally pass a default value to return instead of an error.
static function String::from_int(value: Integer): String
static function String::from_int(s: String, value: Integer): String
static function String::from_hex_int(value: Integer): String
static function String::from_hex_int(s: String, value: Integer): String
static function String::from_float(value: Float): String
static function String::from_long(value: Long): String
static function String::from_long(s: String, value: Long): String
static function String::from_double(value: Double): String
static function String::from_double(s: String, value: Double): String
Return the string representation of the number value. Optionally it can append it into an existing string.