Custom library functions
Use the following custom library functions to process data in strings, arrays and collections.
String library
You can perform string-related operations within an expression using the following library.
String | Description | Input | Output |
---|---|---|---|
where |
Returns |
|
|
where |
Returns |
|
|
where |
Converts all characters to uppercase. Returns all characters in upper case if input is not null. Returns |
|
|
where |
Converts all characters to lowercase. Returns all characters in lower case if input is not null. Returns |
|
|
where |
Removes white space from the start and end of |
|
|
where:
|
Gets a substring from the input string starting from the start position and up until the end position, not including the end position. You can use a negative value to start or end n characters from the end of the string. All position counting is zero-based. If start is not to the left of end, |
|
|
where:
|
Checks if the input string starts with the specified prefix and the comparison is case sensitive. Returns |
|
|
where:
|
Checks if the input string ends with the specified suffix and the comparison is case sensitive. Returns |
|
|
where:
|
Splits the provided text into an array based on the specified separators. Returned array won’t contain any separators. A null separator splits on white space. Returns |
|
|
where:
|
Joins the elements of the provided array into a single string containing the provided elements separated by the provided separator. Returns the joined string or |
|
|
where:
|
Finds the first index of the search string within the input string. A negative start position is treated as zero, and a start position greater than the input string length only matches an empty search. An empty search string ( |
|
|
where:
|
Finds the last index within the input string. Search starts from the start position and continues backwards. A negative start position is treated as zero, and a start position greater than the input string length searches the entire string backwards. Returns |
|
|
where |
Returns the length of the input string or |
|
|
where:
|
Replaces all occurrences of |
|
|
where:
|
Compares two strings lexicographically. Returns |
|
|
where:
|
Parses the string argument as a signed decimal integer (min The characters in the string must all be decimal digits, except that the first character can be an ASCII minus sign ( |
|
|
where:
|
Parses the string argument as a signed decimal long (min The characters in the string must all be decimal digits, except that the first character can be an ASCII minus sign ( |
|
|
where:
|
Translates the decimal string representation of a BigInteger into a BigInteger. The string representation consists of an optional minus sign followed by a sequence of one or more decimal digits. The character-to-digit mapping is provided by Character.digit. If input is null or not a valid Big Integer, |
|
|
where:
|
Parses the string argument as a signed decimal float. If input is null, not a valid Float, or Infinity, |
|
|
where:
|
Parses the string argument as a signed decimal double. If input is null, not a valid number within the range of Double, or Infinity, |
|
|
where:
|
Translates the string representation of a BigDecimal into a BigDecimal. The string representation consists of an optional sign, ( The value of the exponent must lie between |
|
|
where <input> is the string to be encoded. |
Encodes the input string into a new string using the Base64 encoding scheme. Returns the encoded string if input is not empty, or else input is returned as-is. |
|
|
where <input> is the Base64 encoded string to be decoded. |
Decodes a Base64 encoded string into a new string using the Base64 encoding scheme. Returns the encoded string if input is not empty, or else input is returned as-is. This will return null if the input string is not in the valid Base64 schema. |
|
|
where <input> is the string to be encoded. |
Translates a string into application/x-www-form-urlencoded format using UTF-8 encoding scheme. Returns the encoded string if input is not empty, or else input is returned as-is. |
|
|
where <input> is the URL encoded string to be decoded. |
Decodes an application/x-www-form-urlencoded string using UTF-8 encoding scheme. Returns the decoded string if input is not empty, or else input is returned as it is. Returns null if the input string cannot be decoded due to any illegal characters. |
|
|
where:
|
Returns a formatted string using the specified format string and arguments. Returns null if a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions. |
|
|
where:
|
Translates the string representation of a UUID to a GUID in Base64 format. If input is null or not a valid UUID, <defaultIfNullOrInvalid> is returned. |
|
|
where:
|
Returns the first value in the input values which is not empty ('') or null. If all input values are null or empty, then null is returned. There must be at least one input value and the rest are optional. You can enter a maximum of 10 input values. |
|
|
where:
|
Returns the first value in the input values which is not empty (''), null or whitespace only. If all input values are null, empty or blank then null is returned. There must be at least one input value and the rest are optional. You can enter a maximum of 10 input values. |
|
|
Date and time library
You can parse, format, and process the date and time within an expression. Dates use the ISO 8601 format in UTC.
Examples of valid dates:
-
2023-01-01T23:59:59Z
-
2023-01-01T23:59:59.123Z
-
2023-01-01T23:59:59.123456Z
-
2023-01-01T23:59:59+800
Default output formats are in UTC:
-
2023-01-01T23:59:59.001Z
-
2023-01-01Z
-
23:59:59Z
If you input the ISO 8601 format incorrectly, the system returns This library accepts DateTime with millisecond precision greater than 3, but the output always truncates to millisecond precision of 3. Additional input formats not documented above are not officially supported and subject to change without notice. |
String | Description | Input | Output | ||
---|---|---|---|---|---|
where:
|
Adds a number of days to the date represented by a supported ISO 8601 string representation and returns the new date in the default ISO 8601 output format. Returns |
|
|
||
where:
|
Adds a number of months to the date represented by a supported ISO 8601 string representation and returns the new date in the default ISO 8601 output format. Returns |
|
|
||
where:
|
Adds a number of years to the date represented by a supported ISO 8601 string representation and returns the new date in the default ISO 8601 output format. Returns |
|
|
||
where:
|
Adds a number of hours to the date represented by a supported ISO 8601 string representation and returns the new date in the default ISO 8601 output format. Returns |
|
|
||
where:
|
Adds a number of minutes to the date represented by a supported ISO 8601 string representation and returns the new date in the default ISO 8601 output format. Returns |
|
|
||
where:
|
Adds a number of seconds to the date represented by a supported ISO 8601 string representation and returns the new date in the default ISO 8601 output format. Returns |
|
|
||
where |
Returns day-of-month, a value from |
|
|
||
where |
Returns the month from |
|
|
||
where |
Returns value for the year for valid input or |
|
|
||
where |
Returns the hour of the day as a value between |
|
|
||
where |
Returns the minute of the hour as a value between |
|
|
||
where |
Returns the second of the minute as a value between |
|
|
||
|
Obtains the current date-time in default ISO 8601 output format. |
|
<Current date and time in default ISO 8601 format> |
||
where:
|
Obtains the date and time from the provided year, month, day, hour, minute, and second and returns valid date and time in default ISO 8601 output format. Returns |
|
|
||
where |
Transforms the date and time in a supported ISO 8601 format to a UTC date in the format |
|
|
||
where |
Transforms the date and time in a supported ISO 8601 format to a UTC time in the format |
|
|
||
where:
|
Transforms the date and time in a supported ISO 8601 format to the date and time in the specified format. Returns |
|
|
||
where:
|
Compares this date and time to another date and time, including the chronology. Returns |
|
|
||
where:
|
Calculates the number of days between input dates. The result is negative if <inputDateTime2> is before <inputDateTime1>. If either of the input date-time are null, empty, blank or not a supported ISO 8601 format, the value provided for <defaultIfNotDate> is returned. |
|
|
||
where:
|
Calculates the number of weeks between input dates. The result is negative if <inputDateTime2> is before <inputDateTime1>. If either of the input date-time are null, empty, blank or not a supported ISO 8601 format, the value provided for <defaultIfNotDate> is returned. |
|
|
||
where:
|
Calculates the number of months between input dates. The result is negative if <inputDateTime2> is before <inputDateTime1>. If either of the input date-time are null, empty, blank or not a supported ISO 8601 format, the value provided for <defaultIfNotDate> is returned. |
|
|
||
where:
|
Calculates the number of years between input dates. The result is negative if <inputDateTime2> is before <inputDateTime1>. If either of the input date-time are null, empty, blank or not a supported ISO 8601 format, the value provided for <defaultIfNotDate> is returned. |
|
|
||
where:
|
Calculates the period between input dates represented as amount of time in years, months, and days using ISO 8601 period format The letter A zero period is represented as zero days, or The period is calculated by removing complete months, then calculating the remaining number of days, adjusting to ensure that both have the same sign. The number of months is then split into years and months based on a 12 month year. |
|
|
||
where <inputDateTime> is the date-time in a supported ISO 8601 format.
|
Transforms the date-time in a supported ISO 8601 format to the number of seconds from the epoch of 1970-01-01T00:00:00Z. This returns null if <inputDateTime> is null, empty, blank, or not a supported ISO 8601 format. |
|
|
||
where <epochSeconds> is the number of seconds from the epoch of 1970-01-01T00:00:00Z. |
Builds date-time using the number of seconds from the epoch of 1970-01-01T00:00:00Z to a UTC date-time in default ISO 8601 format. Returns null if <epochSeconds> is null. |
|
|
||
where:
|
Parses <inputDateTime> in a format other than ISO 8601 as specified by <format>, and uses any default values specified in <options> if required to transform it to a date-time in ISO 8601 format. Will return null if <inputDateTime>:
|
|
|
||
where:
Zone IDs must match regular expression characters. If the zone ID is not in the Java 8 configured set of IDs, it is invalid. The detailed format of the region ID depends on the group supplying the data. The default set of data is supplied by the IANA Time Zone Database (TZDB). IANA TZDB has region IDs of the form <area>/<city>, such as
|
Transforms the date-time in a supported ISO 8601 format to date-time in the specified timezone in the required format if specified, or the default format Will return null if:
|
|
|
Data library
You can process data in arrays and collections using the following library.
When using a collection format, some of the following methods which perform operations between two arrays or collections determine data type automatically based on Java defaults. For example,
|
String | Description | Input | Output |
---|---|---|---|
where:
|
Finds and returns the index of the |
|
|
where |
Checks if the input array is not empty and not null. |
|
|
where |
Returns true if all elements of |
|
|
where |
Returns |
|
|
where |
Removes the elements in |
|
|
where:
|
Retains only the elements that exist in both |
|
|
where:
|
Returns a new array containing the second array appended to the first array. |
|
|
where |
Returns the size of the input array. |
|
|
where |
Tests two arrays for value-equality and returns |
|
|
Regex library
You can use regular expressions in operations with the following library.
String | Description | Input | Output | ||
---|---|---|---|---|---|
where:
|
Replaces the first substring of the text string that matches the given regular expression with the given replacement. A null reference passed to this method is a no-op and returns |
|
|
||
where:
|
Replaces each substring of the text string that matches the given regular expression with the given replacement. You can use this for 1 or more find and replace options. The first pair of find-replace arguments are mandatory and the rest are optional. |
|
|
||
where:
|
Checks if the entire input string matches the regex pattern. If a null is passed as input, it returns |
|
|
||
where:
|
Find all matching substrings in the input string matching the regex pattern. |
|
|
Crypto library
You can perform crypto operations such as hashing using the following library.
String | Description | Input | Output | ||
---|---|---|---|---|---|
where:
|
Creates a hash for the required data with Hashed Message Authentication Code (HMAC) using the specified secret key and cryptographic hashing function algorithm. Returns the hash or digest as a string containing only hexadecimal digits. Supported algorithms for hashing functions are HmacMD5, HmacSHA1, HmacSHA224, HmacSHA256, HmacSHA384, and HmacSHA512. |
|
|
Core library
You can perform basic conditional expressions using if-else and switch alternatives.
String | Description |
---|---|
where:
|
Library function for an If-Else statement. Expressions provided for If and elseIf conditions should evaluate to a boolean value and if not, every attempt will be made to convert the evaluated value to boolean. If the condition evaluates to a Number, any value greater than 0 will be treated as True, or else false. If the condition evaluates to a String, the values The If statement and elseIf statement is a pair: a condition and a value to be used if condition evaluates to true. The elseIf statements are optional, and can enter 0 to 10 elseIf statements as needed. The elseValue to be used if no condition evaluates to true is also optional and is always the last parameter in the method. |
where:
|
Library function for a switch statement. A <valueToFind> is compared against 1 or more choices to match (<choiceToMatch<1…10>>). If a match is found, the value corresponding to the matched choice (<valueToReturn<1…10>>) is returned. If no match is found, <defaultValue> is returned if provided, or else null. <choiceToMatch<n>> and <valueToReturn<n>> are a pair and there should be a minimum of 1 pair and not exceed 10 pairs. A default value can be provided as the last parameter to the method. |
Examples
String | Input |
---|---|
|
returns
returns |
|
returns
returns |