SubStr()


Extract part of a string from a character string.

Syntax

SubStr(<cString>, <nStart>, [<nCount>]) --> cSubstring

Arguments

<cString> --> is the character string from which to extract a substring.

<nStart> --> is the starting position in <cString>. If <nStart> is positive, it is relative to the leftmost character in <cString>. If <nStart> is negative, it is relative to the rightmost character in the <cString>.

<nCount> --> is the number of characters to extract. If omitted, the substring begins at <nStart> and continues to the end of the string. If <nCount> is greater than the number of characters from <nStart> to the end of <cString>, the extra is ignored.

Returns

SubStr() returns a character string.

Description

SubStr() is a character function that extracts a substring from another character string. SubStr() is related to the Left() and Right() functions which extract substrings beginning with leftmost and rightmost characters in <cString>, respectively.

The SubStr(), Right(), and Left() functions are often used with both the AT() and RAT() functions to locate either the first and/or the last position of a substring before extracting it. They are also used to display or extract only a portion of a character string.

Examples

SubStr('John Smith', 6, 2)

* Result: 'Sm'

SubStr('John Smith', 6)

* Result: 'Smith'

____________________________

Related Topics:

Business Function List



CAPITAL VISUAL BUILDER