SUBSTR

Action

Returns part of a string.

 

Syntax

SUBSTR ("string", start, length)

 

Parameters

String

The string from which to extract a substring.

Start

Numeric value representing the offset in the string where the substring begins.

Length

Optional numeric value representing the length of the substring. If omitted or if there are fewer than Length characters in the text (including the character at start), all characters from the start position to the end of the string are returned.

Returns

The substring indicated by start and length.

 

Example

$x = SUBSTR(@USERID, LEN(@USERID) - 2, 2)   ; get the last 2 chars of the userid