Returns the starting column position of a substring within a string.
INDEX(char-string,substring,substr-occur)
char-string is the string containing the substring, expressed as a variable name, a dynamic array reference, or a literal enclosed in quotes.
substring is the substring to be located, expressed as a variable name, a dynamic array reference, or a literal enclosed in quotes.
substr-occur is an integer delineating which occurrence of the substring is used.
If substring is not found, a value of zero is returned. If substring is null, then the specified occurrence number is returned.
START = INDEX("ABCDEFGHI","DEF",1)
Assigns the value 4 to the variable START.
A = INDEX("CCXXCCXXCC","XX",2)
Assigns the value 7 to A, because the second occurrence of substring XX starts at column 7.
VAR = INDEX("ABC123","Z",1)
Assigns a value of 0 to VAR, because Z is not present in the string ABC123.
X = "1234ABC" Y = "ABC" IF INDEX(X,Y,1)=5 THEN GOTO 3
Transfers control to statement 3, because ABC starts at column position 5 of string X.
S = "X1XX1XX1XX" FOR I=1 TO INDEX(S,"1",3) . . . NEXT I
Executes the loop 8 times, because the third occurrence of 1 appears in column 8 of string S.