These functions all operate on string expressions only, and will return an error if used on any other values.
Except STR()
, which converts to strings.
See also Section 11.1.4, “String operators”.
STR
returns a string representation of the expression.
Syntax: STR( expression )
Arguments:
Query.
MATCH a RETURN str(1) LIMIT 1
A string.
REPLACE
returns a string with the search string replaced by the replace string. It replaces all occurrences.
Syntax: REPLACE( original, search, replace )
Arguments:
Query.
MATCH a RETURN replace('hello' , 'l' , 'w') LIMIT 1
A string.
SUBSTRING
returns a substring of the original, with a 0-based index start and length. If length is omitted, it returns a substring from start until the end of the string.
Syntax: SUBSTRING( original, start [, length] )
Arguments:
Query.
MATCH n RETURN substring('hello' , 1, 3), substring('hello' , 2) LIMIT 1
A string.
LEFT
returns a string containing the left n characters of the original string.
Syntax: LEFT( original, length )
Arguments:
Query.
MATCH n RETURN left('hello' , 3) LIMIT 1
A String.
RIGHT
returns a string containing the right n characters of the original string.
Syntax: RIGHT( original, length )
Arguments:
Query.
MATCH n RETURN right('hello' , 3) LIMIT 1
A string.
LTRIM
returns the original string with whitespace removed from the left side.
Syntax: LTRIM( original )
Arguments:
Query.
MATCH n RETURN ltrim(' hello') LIMIT 1
A string.
RTRIM
returns the original string with whitespace removed from the right side.
Syntax: RTRIM( original )
Arguments:
Query.
MATCH n RETURN rtrim('hello ') LIMIT 1
A string.
TRIM
returns the original string with whitespace removed from both sides.
Syntax: TRIM( original )
Arguments:
Query.
MATCH n RETURN trim(' hello ') LIMIT 1
A string.
LOWER
returns the original string in lowercase.
Syntax: LOWER( original )
Arguments:
Query.
MATCH n RETURN lower('HELLO') LIMIT 1
A string.
Copyright © 2013 Neo Technology