How do I get the first position of a substring in a string

I'm looking for a simple string function to get the first position of a substring in a string. Something equivalent of indexOf(), strPos(), charIndex()... Didn't find anything in Cypher or Apoc - only issue 1041, open since 2013?

There is nothing direct in Cypher. I was totally sure we already had it in apoc.
Gonna add it this week.

As a workaround in the meantime you can use split + length:

RETURN length(split("ab-c","-")[0])

Added an issue here: Add apoc.text.indexOf · Issue #896 · neo4j-contrib/neo4j-apoc-procedures · GitHub


Did apoc.text.indexOf get dropped? I am sure I used it in the past, but in v3.3.0.2 it does not exist

I'm using and, there apoc.text.indexOf exists. In the 4.0rc code also. I'm not sure in which version it was introduced.