Character Selection Operator ([])
The [] operator selects a subset of the characters of its operand. Either a single character offset or a range of characters may be specified. Character offsets are zero based, where the zeroth character is the first one in the string.
Example
STRING hello := "hello world"; PRINT(hello[0], "\n"); PRINT(hello[10..6], "\n");
Output:
h world
Reversed ranges
If the character range is reversed, then the resulting string is also reversed.
Example
STRING hello := "hello world"; PRINT(hello[0..10], "\n");
Output:
dlrow olleh
Multiple ranges
A list of character ranges and offsets separated by commas may also be specified to select several substrings and concatenate them.
STRING alphabet := "abcdefghijklmnopqrstuvwxyz"; PRINT(alphabet[3..5, 9, 20..17], "\n");
Output:
fedjrstu
XJTAG v4.2.5
