apoc.coll.indexOfFunctionDeprecated in 25
|
This function is deprecated.
Use Cypher’s |
Syntax |
|
||
Description |
Returns the index for the first occurrence of the specified value in the |
||
Arguments |
Name |
Type |
Description |
|
|
The list to find the given value in. |
|
|
|
The value to find the first occurrence of in the given list. |
|
Returns |
|
||
Usage examples
The following returns the index of the value 3 in the list using both APOC and Cypher:
apoc.coll.indexOf
RETURN apoc.coll.indexOf([1,3,5,7,9], 3) AS output;
Using Cypher’s coll.indexOf
RETURN coll.indexOf([1,3,5,7,9], 3) AS output;
| Output |
|---|
1 |
The following returns -1 as it fails to find the value in the list using both APOC and Cypher:
apoc.coll.indexOf
RETURN apoc.coll.indexOf([1,3,5,7,9], 4) AS output;
Using Cypher’s coll.indexOf
RETURN coll.indexOf([1,3,5,7,9], 4) AS output;
| Output |
|---|
3 |