Usage
x[y]
Extracts the y element from string x.
x[y to z]
Extracts the y to z range of elements from string x.
x[n]
Extracts the n element of array x.
Note: The subscript ranges are 1-based; they start at 1 rather than 0.
Subscript is used to extract one or more characters from a text string or to extract an element from an array.
Examples
The following examples are applicable to Crystal syntax:
[100,233,466,998][3]
Returns 466; 466 is the third element in the array.
LNAME [1]
Returns "S", where LNAME = "Smith".
Postal [6]
Returns "V", where Postal Code = "T5A 9V2" (the space between A and 9 counts as an element).
{customer.POSTAL CODE} [5 to 7]Returns "9V2", where Postal Code = "T5A 9V2".
{file.ITEMNUMBER} [4 to 5]Returns "40", where ItemNumber is A1/4020/B10.
Comments
While Subscript tests a target string for the presence of an element and extracts the element (if found) from the string, In String only tests the target string for the presence of the element.