substring extraction

substring extraction


substring expressions Index Level substring field store
Syntax string.expression[beg.pos.expression, len.expression]  
Category BASIC
Type Definition
Description allows the extraction of a string from within another string.

The "beg.pos.expression" must evaluate to a number indicating the starting position within the string, and the "len.expression" must evaluate to a number indicating the number of characters to retrieve.  

If the starting character specification is past the end of the string value, an empty substring value is selected. If the starting character specification is negative or zero, the substring is assumed to start at character one.

If the substring length specification exceeds the remaining number of characters in the string, the remaining string is selected. If the substring length specification is negative or zero, an empty substring is selected.
Options
See Also [ FIELD assignment CASING substring assignment substring expressions substring field store
Example if response[1,1] = "y" then printer on

This tests the first character of "response" to determine if it is the letter "y". If it is, the "printer on" statement is issued. See "casing" for case-sensitive input.

area.code = phone[1,3]

This extracts the first three characters of the "phone" variable and assigns it to the variable "area.code"
Warnings
Compatibility D3 7.0 AP R83
substring expressions Index Level substring field store