INDEX(), INDEXS() |
![]() ![]() ![]() |
The INDEX() function returns the position of a specified occurrence of a substring within a string. The INDEXS() function is similar to INDEX() but operates on each element of a dynamic array element separately, locating the required occurrence of substring and returning a similarly structured dynamic array of results.
Format
INDEX(string, substring, occurrence)
where
The INDEX() function locates the specified occurrence of substring within string and returns its character position.
If occurrence is less than one or the desired occurrence of substring is not found, the INDEX() function returns zero.
If substring is null, the value of occurrence is returned.
Use of the $NOCASE.STRINGS compiler directive makes the comparison case insensitive.
Examples
N = INDEX(S, "*", 3)
This statement assigns N with the character position of the third asterisk in variable S.
S = "ABABABABABAB" N = INDEX(S, "ABA", 2)
sets N to 5. |