apoc.text.indexOf

Details

Syntax

apoc.text.indexOf(text, lookup [, from, to ])

Description

Returns the first occurrence of the lookup STRING in the given STRING, or -1 if not found.

Arguments

Name

Type

Description

text

STRING

The string to search for the lookup string in.

lookup

STRING

The lookup string to search for in the given string.

from

INTEGER

The index at which to start the search. The default is: 0.

to

INTEGER

The index at which to stop the search. The default is: -1.

Returns

INTEGER

Usage Examples

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

0

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

13