pretty simple question, is there a way to get length of a string in Neo4j cypher? I cannot find any document for that.
thanks
To return the length of a string in Cypher, use the SIZE()
function. The LENGTH()
function is now exclusively used for measuring PATHs in the graph.
RETURN size("This is an example string")
yields 25
From the good folks at Neo: "This feature is deprecated and will be removed in future versions. Using length
on anything that is not a path is deprecated, please use size
instead"
Try length()
, like
RETURN length("hello world")
in 2.0 (return-only queries are new in 2.0) or
START n=node(5)
RETURN length(n.name)
or some such for 1.9.
You can use the length() scalar function like:
MATCH (n:Crew)-[r:KNOWS*]-m
WHERE n.name='Neo'
RETURN n AS Neo,r,m,length(n.name)
Check out this example here.