String Functions
Match Functions
-
startsWith(x, term): Checks if the stringxstarts with the passedterm. Matches are case-sensitive. -
endsWith(x, term): Checks if the stringxends with the passedterm. Matches are case-sensitive. -
contains(x, term): Checks if the stringxcontains the passedtermanywhere. Matches are case-sensitive. -
match(x, pattern)ormatch(x, pattern, group): Checks if stringxcontains a match for givenpatternand returns the match. If agroupnumber is provided, only the matching subgroup will be returned. If no match is found, empty string is returned. See pattern-match for a variable operation that contains additional matching capabilities. -
test(x, pattern): Checks if stringxcontains the givenpattern. See pattern-test for a variable operation that contains additional capabilities.
Modify Functions
-
replace(x, pattern, replacement): Checks stringxfor all substrings matching the givenpatternand replaces them with the givenreplacement. Supports backreferences like $1, $2, …. See pattern-replace for a variable operation that contains additional capabilities. -
lpad(x, length, c): Pads a stringxto the left with the characterc, so that the padded string haslengthcharacters. -
rpad(x, length, c): Pads a stringxto the right with the characterc, so that the padded string haslengthcharacters.
Misc Functions
-
asc(x): Gets the ASCII character of the numberx. Ifxis an array of numbers, gets a corresponding ASCII string. -
ord(x)orord(x, index): Gets the ASCII ordinal value of the first character or character atindexof stringx. -
size(x): Gets the length of stringx. If x is an array, gets the number of elements in the array.
Examples
startsWith(msg, 'EX')
endsWith(msg, 'EX')
contains(msg, 'error')
match(msg, 'M\d+'')
match(msg, 'M(\d+)'', 1)
test(msg, 'M60(\s|$)')
replace(msg, 'M(\d+)', '$1')
asc([ch1, ch2, ch3, ch4])