apoc.text.indexOf

Function APOC Core

apoc.text.indexOf(text, lookup, from=0, to=-1==len) - find the first occurence of the lookup string in the text, from inclusive, to exclusive, -1 if not found, null if text is null.

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