right()
returns a string containing the specified number of rightmost characters of the original string.
Syntax: right(original, length)
Returns: A String.
Arguments
Name | Description |
original | An expression that returns a string. |
length | An expression that returns a positive integer. |
Example
RETURN right("Hello, World!", 5)
The value returned will be a string that contains the rightmost 4 characters of the string “Hello, World!”. Hence the returned string will be “orld!”.
Considerations
right(null, length)
returnsnull
.right(null, null)
returnsnull
.right(original, null)
will raise an error.- If
length
is not a positive integer, an error is raised. - If
length
exceeds the size oforiginal
,original
is returned.
Example
RETURN right("Cypher Tutorials!", 4)
Returns the following Result
right("Cypher Tutorials!", 4) |
"als!" |
Example
RETURN right("Cypher Tutorials!", 12)
Returns the following Result
right("Cypher Tutorials!", 12) |
"r Tutorials!" |
Example
RETURN right("Cypher Tutorials!", 18)
Returns the following Result
right("Cypher Tutorials!", 18) |
"Cypher Tutorials!" |
Note– If length
exceeds the size of original
, original
is returned.
Example
RETURN right("Cypher Tutorials!", -2)
Returns the following Result
right("Cypher Tutorials!", -2) |
Error Neo.DatabaseError.General.UnknownError |
Note– If length
is not a positive integer, an Error
is raised.
Example
RETURN right("Cypher Tutorials!", null)
Returns the following Result
right("Cypher Tutorials!", null) |
Error Neo.ClientError.Statement.TypeError |
Note– right(original, null)
returns Error
.
Example
RETURN right(null, 4)
Returns the following Result
right(null, 4) |
null |
Note– right(null, length)
returns null
.
Example
RETURN right(null, null)
Returns the following Result
right(null, null) |
null |
Note– right(null, null)
returns null
.