apoc.text.indexOf

Function

apoc.text.indexOf(text STRING, lookup STRING, from INTEGER, to INTEGER) - returns the first occurrence of the lookup STRING in the given STRING, or -1 if not found.

Signature

apoc.text.indexOf(text :: STRING, lookup :: STRING, from = 0 :: INTEGER, to = -1 :: INTEGER) :: INTEGER

Input parameters

Name Type Default

text

STRING

null

lookup

STRING

null

from

INTEGER

0

to

INTEGER

-1

Usage Examples

RETURN apoc.text.indexOf("Hello World", 'Hello') AS output;
Table 1. Results
output

0

Starting from index 3, find the first occurrence of 'Hello',
RETURN apoc.text.indexOf("Hello World, Hello", 'Hello', 3) AS output;
Table 2. Results
output

13