SubStr

Syntax

SubStr(source_str|start_pos[|length])

Description

Extracts a substring of a specified number of characters beginning at a specified location in a source string.

If length is not specified, SubStr returns the substring starting at the position specified in start_pos and continuing to the end of the string.

Parameters

Parameter Description

source_str

A string from which to extract a substring.

start_pos

A number representing the character position in source_str where the substring starts, starting at 1.

length

(Optional) A number specifying the number of characters in the substring.

Returns

Returns a string equal to a substring length characters long beginning at character start_pos of source_str.

Example

The following table presents examples of using SubStr function.

Expression Result

substr(''12345678''|2|3)

234

substr(''12345678''|2)

2345678