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
Name | Description |
original | An expression that returns a string. |
splitDelimiter | The 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)
returnsnull
.split(original, null)
returnsnull
.split(null, null)
returnsnull
.
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 |
Note– split(original, null)
returns null
.
Example
RETURN split(null, " ")
Returns the following Result
split(null, " ") |
null |
Note– split(null, splitDelimiter)
returns null
.
Example
RETURN split(null, null)
Returns the following Result
split(null, null) |
null |
Note– split(null, null)
returns null
.