Strings
len
fun len() > int
Returns: Length of the string
upper
fun upper() > str
Returns: Uppercased string
lower
fun lower() > str
Returns: Lowercased string
trim
fun trim() > str
Returns: Trimmed string
byte
fun byte(int at = 0) > int
Get byte value of character
at
: index of character in the string
Returns: Byte value of character
indexOf
fun indexOf(str needle) > int?
Find needle in string
needle
: needle to find
Returns: Index of found match
startsWith
fun startsWith(str needle) > bool
Test if strings starts with needle
needle
: needle to find
Returns: true
if strings starts with needle
endsWith
fun endsWith(str needle) > bool
Test if strings ends with needle
needle
: needle to find
Returns: true
if strings ends with needle
replace
fun replace(str needle, str with) > str
Replace first occurence of needle
needle
: needle to findwith
: replacement
Returns: New string
split
fun split(str separator) > [str]
Split string
separator
: separator by which the string will be split
Returns: Splitted string
sub
fun sub(int start, int? len) > str
Get sub string
start
: Sub string start indexend
: Length of sub string, ifnull
will go until end of string
Returns: The substring
repeat
fun repeat(int n) > str
Repeat string
n
: How many times the string will be repeated
Returns: New string
encodeBase64
fun encodeBase64() > str
Base64 encode the string
Returns: Encoded string
decodeBase64
fun decodeBase64() > str
Base64 decode the string
Returns: Decoded string
hex
fun hex() > str
Converts binary string to hexadecimal representation
Returns: Hex string
bin
fun bin() > str
Converts hexadecimal string to binary string
Returns: Binary string
utf8Len
fun utf8Len() > int
Returns: Number of UTF8 codepoints in the string or 0
if string is not a valid UTF8 sequence
utf8Valid
fun utf8Valid() > bool
Returns: true
if string is a valid UTF8 sequence
utf8Codepoints
fun utf8Codepoints() > [str]
Returns: Return a list of the UTF8 string codepoints or an empty list if the string is not a valid UTF8 sequence