substring

Description: Returns a portion of the Subject, given a starting index and an optional ending index. If the ending index is not supplied, it will return the portion of the Subject starting at the given 'start index' and ending at the end of the Subject value.

The starting index and ending index are zero-based. That is, the first character is referenced by using the value 0, not 1.

If either the starting index is or the ending index is not a number, this function call will result in an error.

If the starting index is larger than the ending index, this function call will result in an error.

If the starting index or the ending index is greater than the length of the Subject or has a value less than 0, this function call will return an empty string.

Subject Type: String

Arguments:

  • starting index : The 0-based index of the first character to capture (inclusive)

  • ending index : The 0-based index of the last character to capture (exclusive)

Return Type: String

Examples:

If we have an attribute named "filename" with the value "a brand new filename.txt", then the following Expressions will result in the following values:

Expression

Value

${filename:substring(0,1)}

a

${filename:substring(2)}

brand new filename.txt

${filename:substring(12)}

filename.txt

${filename:substring( ${filename:length():minus(2)} )}

xt