Extracts the substring between two zero-based indexes of a source string.
A negative index is considered an offset from the end of the string. If an index is outside of the source string's range, it is clamped to the bounds of the range.
Both start
and end
arguments are required; otherwise, a deployment error
occurs.
Arguments
source
string
The string whose substring will be returned.
start
int
The start index (inclusive) of the substring. Index is zero-based.
end
int
The end index (exclusive) of the substring. Index is zero-based.
Returns
The substring.
Raised exceptions
TypeError
source
is not a string; or, if either start
or end
is not an integer.Examples
Example 1
- returnStep : return : ${text.substring("hello", 2, 4)} # returns "ll"
Example 2
# Negative index is offset from string end and clamped to range bounds - returnStep : return : ${text.substring("hello", -10, 10)} # returns "hello"

