Cypher Trim Function

trim() returns the original string with leading and trailing whitespace removed.

Syntax: trim(original)

Returns: A String.

Arguments

NameDescription
originalAn expression that returns a string.

Example

RETURN trim(" Hello, World! ")

The value returned will be a string that will be similar to the original string except all the leading and trailing whitespace would have been removed. Hence the returned string will be “Hello, World!”.

Considerations

  • trim(null) returns null.

Example

RETURN trim(" Cypher Tutorials!")

Returns the following Result

trim(" Cypher Tutorials!")
"Cypher Tutorials!"

Example

RETURN trim("Cypher Tutorials! ")

Returns the following Result

trim("Cypher Tutorials! ")
"Cypher Tutorials!"

Example

RETURN trim(" Cypher Tutorials! ")

Returns the following Result

trim(" Cypher Tutorials! ")
"Cypher Tutorials!"

Example

RETURN trim("Cypher Tutorials!")

Returns the following Result

trim("Cypher Tutorials!")
"Cypher Tutorials!"

Example

RETURN trim(null)

Returns the following Result

trim(null)
null

Notetrim(null) returns null.

Learn More