FIELD Function
Returns a character-delimited field from within a string.
Syntax
FIELD(string, delimiter, fieldNumber)
Syntax Elements
string An expression that evaluates to the string to be searched.
delimiter The character used as a field delimiter. If delimiter contains more than one character, only the first is used.
fieldNumber A positive integer specifying which field to return. The fields are numbered starting from 1. If the field number is less than 1, field 1 is returned.
Comments
If delimiter is a empty string, an empty string is returned.
Case Insensitivity
If data case insensitive mode is selected (see Case Sensitivity), case is ignored when searching string for delimiter.
See Also
GROUP function, COL1/COL2 functions.
Examples
T = "12345.67891.98765" G = FIELD(T,".",1)
Returns the substring 12345 to variable G.
A=FIELD("XXX:YYY:ZZZ:555",":",3)
Assigns the value ZZZ to variable A.
X = "77$ABC$XX" Y = "$" Z = "ABC" IF FIELD(X,Y,2)=Z THEN STOP
Terminates the program because the FIELD function returns the value "ABC" which is equal to Z.