substring

Returns a substring of a given string. The substring is specified by the index of the given string where the substring begins and the length of the substring. The length can be specified either explicitly or as the remaining characters after the beginning of the substring.

Syntax

    substring(string, number, number?)

Parameters

A string and one or more numbers separated by commas. The string is the parameter from which the substring is extracted. The first number is the index of the string parameter where the substring begins. The second number, if provided, is the length of the substring. If the third parameter is not provided, the substring includes the characters from the index to the end of the given string.

Returns

String.

Example

For example, the first of the following two expressions returns 234, and the second expression returns 6789:

substring("123456789",2,3) 
substring("123456789",6)