◷ Reading Time: 7 minutes
substring
Retrieves a substring from a string value. 1st place position is 1, last position is -1.
substring (value, index, length)- value (string): a value to be used as source (Mandatory)
- index (string): The one-based starting character position of a substring in this instance
- length (int): The number of characters in the substring (optional)
Example: substring ('Substring this sentence', 1, 3)
Result: SubExample: substring ('01234', 3)
Result: 234Example: substring("foobar",-2)
Result: "ar"string length
Return number of characters (or code points) in string.
string length (value,)- value (string): a value to be used as source (Mandatory)
Example: string length ('apple')
Result: 5Example: string length ('11/23DavaneyAv')
Result: 14upper case
Returns a copy of this string converted to uppercase.
upper case (value)- value (string): the value to be converted to uppercase (Mandatory)
Example: upper case ('hello')
Result: HELLOExample: upper case ('HeLlo')
Result: HELLOExample: upper case ('hELlo123')
Result: HELLO123lower case
Returns a copy of this string converted to lowercase.
lower case (value)- value (string): the value to be converted to lowercase (Mandatory)
Example: lower case ('HeLlo')
Result: helloExample: lower case ('HeLlo')
Result: helloExample: lower case ('HeLlo123')
Result: hello123substring before
Return substring of string before the match in string
substring before (value, match)- value(string): a value to be used as source (Mandatory)
- match: a part of value to match with (Mandatory)
Example: substring before ('foobar', 'bar')
Result: 'foo'Example: substring before ('macdonald', 'na')
Result: 'macdo'substring after
Return substring of string after the match in string
substring after (value, match)- value(string): a value to be used as source (Mandatory)
- match: a part of value to match with (Mandatory)
Example: substring after ('foobar', 'fo')
Result: 'obar'Example: substring after ('macdonald', 'na')
Result: "ld"replace
Regular expression pattern matching and replacement.
replace (value, pattern, replacement, flags)- value: a value to be used as source (Mandatory)
- pattern: the pattern identifies which substrings in the input string should be replaced. (Mandatory)
- replacement: New string for the replacement
- flags: Optional
Example: replace ('banana', 'a', 'o')
Result: bononoExample: replace ('hello wOrld', '[aeiou]', '','i')
Result: hll wrldcontains
Check the string contain the match.
contains (value, match)- value (string) : value to be checked (Mandatory)
- match(string): the string to match with (Mandatory)
Example: contains ("foobar", "fo")
Result: TrueExample: contains ('foobar','Smith')
Result: Falsestarts with
Determines whether the beginning of this string instance matches a specified string.
starts with (value , match)- value (string) : value to be checked (Mandatory)
- match(string): the starting string to match with (Mandatory)
Example: starts with ('hello world','hello')
Result: TrueExample: starts with ('hello world', 'world')
Result: FalseExample: starts with ('hello world','he')
Result: Trueends with
Determines whether the end of this string instance matches a specified string.
ends with (value, match)- value (string) : value to be checked (Mandatory)
- match(string): the ending string to match with (Mandatory)
Example: ends with ('hello world', 'world')
Result: TrueExample: ends with ('hello world', 'hello')
Result: FalseExample: ends with ('hello world', 'ld')
Result: Truematches
Determines whether a string matches a specific regular expression pattern.
matches (value, pattern, plags)- value (string): Input string to check. If it is not a string, it will return false (Mandatory)
- pattern (string): regexp pattern (Mandatory)
Example: matches ('foobar', '^fo*b')
Result: TrueExample: matches ("test@gmail.com","\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*")
Result: Truesplit
Splits a string into substrings that are based on the characters in an array.
split (value, splitter)- value (string): a value to be split (Mandatory)
- splitter (string, array): splitter char, string or an array of multiple splitter (Mandatory)
Example: split ('Split this sentence into words', ' ')
Result: [
"Split",
"this",
"sentence",
"into",
"words"
]Example: split ('a,b,c,d', ',')
Result: [
'a',
'b',
'c',
'd'
] string join
Concatenates the elements of specified members of a collection/array, using the specified separator between each member. The output is a string.
string join (value, splitter, trim)- value (string): a value to be split (Mandatory)
- splitter (string): splitter char, string or an array of multiple splitter (optional)
Example: string join (["a", "b", "c"], "_and_ ")
Result: "a_and_b_and_c"
Example: string join (["a", "b", "c"])
Result: "abc"