String Functions
substring()​
- parameters:
string
: stringstart position
: number- (optional)
length
: number
- result: string
substring("foobar",3)
// "obar"
substring("foobar",3,3)
// "oba"
string length()​
- parameters:
string
: string
- result: number
string length("foo")
// 3
upper case()​
- parameters:
string
: string
- result: string
upper case("aBc4")
// "ABC4"
lower case()​
- parameters:
string
: string
- result: string
lower case("aBc4")
// "abc4"
substring before()​
- parameters:
string
: stringmatch
: string
- result: string
substring before("foobar", "bar")
// "foo"
substring after()​
- parameters:
string
: stringmatch
: string
- result: string
substring after("foobar", "ob")
// "ar"
contains()​
- parameters:
string
: stringmatch
: string
- result: boolean
contains("foobar", "of")
// false
starts with()​
- parameters:
input
: stringmatch
: string
- result: boolean
starts with("foobar", "fo")
// true
ends with()​
- parameters:
input
: stringmatch
: string
- result: boolean
ends with("foobar", "r")
// true
matches()​
- parameters:
input
: stringpattern
: string (regular expression)
- result: boolean
matches("foobar", "^fo*bar")
// true
replace()​
- parameters:
input
: stringpattern
: string (regular expression)replacement
: string (e.g.$1
returns the first match group)- (optional)
flags
: string ("s", "m", "i", "x")
- result: string
replace("abcd", "(ab)|(a)", "[1=$1][2=$2]")
// "[1=ab][2=]cd"
replace("0123456789", "(\d{3})(\d{3})(\d{4})", "($1) $2-$3")
// "(012) 345-6789"
split()​
- parameters:
string
: stringdelimiter
: string (regular expression)
- result: list of strings
split("John Doe", "\s" )
// ["John", "Doe"]
split("a;b;c;;", ";")
// ["a", "b", "c", "", ""]