Skip to main content
Previous sectionNext section

INDEXS

Returns the starting position of a substring for each element of a dynamic array.

Synopsis

INDEXS(dynarray,substring,occurs)

Arguments

dynarray A dynamic array of elements to be searched for substring. An expression that resolves to a dynamic array.
substring An expression that resolves to a substring to locate within string.
occurs An expression that resolves to a positive integer specifying which occurrence of substring to locate.

Description

The INDEXS function returns a dynamic array of integers, each integer element containing the starting character position, counting from 1, of substring within the corresponding dynarray element. Matching of substring is case-sensitive. You use the occurs argument to specify which occurrence of substring to return the location of.

INDEXS returns 0 for a dynamic array element for any of the following:

  • If substring does not occur in the element.

  • If dynarray or substring is the null string ("").

  • If occurs specifies more occurrences of substring than appear in the element.

  • If occurs is 0, a negative number, a decimal number, the null string, or a non-numeric string.

If occurs is a mixed numeric string, the numeric part is parsed until a non-numeric character is encountered. Thus “7dwarves” is parsed as 7.

See Also