strSubstring

Retrieves a substring from a string.

The first character has an index value of 0.

Note:

Use the Special String Operators for string concatenation, string inclusion, and simple comparison.

Type and Usage

Parameters

Takes either two or three parameters:

  • The first parameter is the string.

  • The second parameter is a number representing the start index.

  • The third optional parameter is a number representing the stop index.

Output

Returns a substring.

  • If the stop index parameter is specified, the substring starting with the character at the start index and ending one character before the stop index is returned.

  • If the stop index parameter is not specified, the substring from the start index to the end of the string is returned.

Example

Retrieves the first two characters of the string my:

<$strSubstring("mystring",0,2)$>

Retrieves the string after the second character string:

<$strSubstring("mystring",2)$>

See Also