In this Page
...
String Literals
String literals function the is similar to JavaScript strings.
A string literal can be constructed with either single quotes or double quotes.
...
Description | Returns true or false after determining if one string can be found within another. If position is specified, the search will begin there. Position defaults to 0. | ||
---|---|---|---|
Syntax |
| ||
Example | Expression: where $msg contains "Hello, World" Result: true To specify a position in the string where to start searching: Expression: where $msg contains "Hello, World" Result: false (because "Hello" exists before that position) |
...
Description | Returns true or false after determining if one string ends with the characters of another. Optional parameters include This is similar to the JavaScript endsWith. | ||
---|---|---|---|
Syntax |
| ||
Example | Expression: Result: true Expression: Result: true |
...
Description | Returns the string in kebabCase. This is similar to the Lodash Lodash kebabCase. | ||
---|---|---|---|
Syntax |
| ||
Example | Expression: $action.kebabCase() where $action is "Check_in" Result: check-in |
...
Description | Returns the index within the calling This is similar to the JavaScript lastIndexOf. | ||
---|---|---|---|
Syntax |
| ||
Example | Expression: $email.lastIndexOf("xe") where $email is "vp@example.com" Result: 410 |
length
Description | Returns the number of code units in the string. This is similar to the JavaScript length. | ||
---|---|---|---|
Syntax |
| ||
Example | Expression: $first.length where $first contains John Result: 4 |
...
Description | Returns an array of results when matching a string against a regular expression object. This is similar to the JavaScript match. | ||
---|---|---|---|
Syntax |
| ||
Example | The argument to match() takes a string that will be interpreted as a regular expression. This enables you to create expressions such as the following to perform a global search to match strings in the employee code that contain actual employee ID values, followed by any five digits:
To match a whole word in a given variable called FirstName: Expression: $FirstName.match(/\bJohn\b/g) where \b sets the word boundary and looks for string 'John' in the incoming string variable called $FirstName Result: John |
...
Description | Returns a new string with some or all matches of a pattern replaced by another. The replacement can be a string or a function that is called for each match. If the first argument is a regular expression, the method will replace all matches if the global flag is set (e.g. /test/g). If the global flag is not set or the first argument is a string, only the first match will be replaced. If the replacement is a function, its result will be used as the replacement for a given match. The function will be passed the following parameters:
This is similar to the JavaScript replace. | ||
---|---|---|---|
Syntax |
| ||
Example |
|
...
Description | Returns a new string with text extracted from another string. If beginIndex is greater than or equal to the length of the string, an empty string is returned. If it is negative, it returns that many characters from the end of the string length. If This is similar to the JavaScript slice. | ||
---|---|---|---|
Syntax |
| ||
Example | Where $String contains "Copyright 2017 All rights reserved." Expression: $String.slice(10) Result: 2017 All rights reserved. Expression: $String.slice(10,14) Result: 2017 Expression: $String.slice(10,-2) Result: 2017 All rights reserve Expression: $String.slice(-2) Result: d. |
...
Description | Swaps out a part of the string using placeholders with another. This is similar to JavaScript sprintf() but includes extended functionality as described in java.util class formatter. | ||
---|---|---|---|
Syntax |
| ||
Example | Where $msg is "hello %s %s" Expression: Result: Where $msg is "hello %2$s %1$s" Expression: Result: |
...