Cypher Split Function

split() returns a list of strings resulting from the splitting of the original string around matches of the given delimiter.

Syntax: split(original, splitDelimiter)

Returns: A List of Strings.

Arguments

NameDescription
originalAn expression that returns a string.
splitDelimiterThe string with which to split original.

Example

RETURN split("Hello, World!", " ")

The value returned will be a list of strings which are obtained once the original string, “Hello, World!” is split around the delimiter string. In the given example, if “Hello, World!” is split around ” “, we will have a list that will contain the strings “Hello,” and “World!”.

Considerations

  • split(null, splitDelimiter) returns null.
  • split(original, null) returns null.
  • split(null, null) returns null.

Example

RETURN split("Learning Cypher!", " ")

Returns the following Result

split("Learning Cypher!", " ")
["Learning", "Cypher!"]

Example

RETURN split("We are learning Cypher!", " ")

Returns the following Result

split("We are learning Cypher!", " ")
["We", "are", "learning", "Cypher!"]

Example

RETURN split("Hakuna-Matata", " ")

Returns the following Result

split("Hakuna-Matata", " ")
["Hakuna-Matata"]

Example

RETURN split("Hakuna-Matata", "-")

Returns the following Result

split("Hakuna-Matata", "-")
["Hakuna", "Matata"]

Example

RETURN split("We are learning Cypher", "e ")

Returns the following Result

split("We are learning Cypher", "e ")
["W", "ar", "learning Cypher!"]

Note– The splitDelimiter in this case is "e " and not "e".

Example

RETURN split("We are learning Cypher", null)

Returns the following Result

split("We are learning Cypher", null)
null

Notesplit(original, null) returns null.

Example

RETURN split(null, " ")

Returns the following Result

split(null, " ")
null

Notesplit(null, splitDelimiter) returns null.

Example

RETURN split(null, null)

Returns the following Result

split(null, null)
null

Notesplit(null, null) returns null.

Learn More