INDEXOF function
Synopsis
This function
returns the index of the first value in the array for which the
specified condition is true. If no such value is found, this
function returns 0.
Variations
INDEXOF(
SourceArray,
Condition)
Returns the index of the first
value that satisfies the condition.
Details |
Examples |
Details and examples
Parameters
SourceArray
Specifies the array from which to find the index.
Supported types: Boolean array; Numeric
array; String array; Point array; Object array.
Condition
Specifies the condition that an element must satisfy for the
function to return its index.
Supported types: Boolean.
Returns
Examples
1. |
In the following example, -15 is the first value that satisfies
the condition, so the function returns its index, 3.
INDEXOF([10, 25,
-15, 5, -20], Item < 0)
|
INDEXOF(
SourceArray,
StartIndex,
Count,
Condition)
Returns the index of the first
value that satisfies the condition, specified within the subset of
SourceArray.
Details |
Examples |
Details and examples
Parameters
SourceArray
Specifies the array from which to find the index.
Supported types: Boolean array; Numeric
array; String array; Point array; Object array.
StartIndex
Specifies the index of the first element of the subset in the
source array.
Supported types: Numeric.
Count
Specifies the number of elements (beginning at StartIndex) to include in the subset of the
source array.
Supported types: Numeric.
Condition
Specifies the condition that an element must satisfy for the
function to return its index.
Supported types: Boolean.
Returns
Examples
1. |
In this example, the index of the first occurrence of "Matrox"
after the start index is 4, so the function returns 4.
INDEXOF(["Matrox", "Design", "Assistant", "Matrox", "Imaging"], 2,
3, Item = "Matrox")
|