YMatrix
Quick Start
Connecting
Benchmarks
Deployment
Data Usage
Manage Clusters
Upgrade
Global Maintenance
Expansion
Monitoring
Security
Best Practice
Technical Principles
Data Type
Storage Engine
Execution Engine
Streaming Engine(Domino)
MARS3 Index
Extension
Advanced Features
Advanced Query
Federal Query
Grafana
Backup and Restore
Disaster Recovery
Graph Database
Introduction
Clauses
Functions
Advanced
Guide
Performance Tuning
Troubleshooting
Tools
Configuration Parameters
SQL Reference
replace()replace() returns a string in which all occurrences of a specified substring in the original string are replaced by another (specified) substring.
Syntax: replace(original, search, replace)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
search |
An expression that evaluates to the substring to locate and replace in original. |
replace |
An expression that evaluates to the replacement substring. |
Notes:
null if any argument is null. search is not found in original, original is returned unchanged.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN replace('hello', 'l', 'w')
$$) as (str_array agtype);
Result:
| new_str |
|---|
| "hewwo" |
| 1 row |
split()split() returns a list of strings formed by splitting the original string at each occurrence of the given delimiter.
Syntax: split(original, split_delimiter)
Returns:
An agtype list of agtype strings.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
split_delimiter |
A string used to split original. |
Notes:
split(null, split_delimiter) and split(original, null) both return null.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN split('one,two', ',')
$$) as (split_list agtype);
Result:
| split_list |
|---|
| ["one","two"] |
| 1 row |
left()left() returns a string containing the leftmost n characters of the original string.
Syntax: left(original, n)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
n |
An expression that evaluates to a positive integer. |
Notes:
left(null, n) and left(null, null) return null. left(original, null) raises an error. n is not a positive integer. n exceeds the length of original, original is returned unchanged.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN left('Hello', 3)
$$) as (new_str agtype);
Result:
| new_str |
|---|
| "Hel" |
| 1 row |
right()right() returns a string containing the rightmost n characters of the original string.
Syntax: right(original, n)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
n |
An expression that evaluates to a positive integer. |
Notes:
right(null, n) and right(null, null) return null. right(original, null) raises an error. n is not a positive integer. n exceeds the length of original, original is returned unchanged.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN right('hello', 3)
$$) as (new_str agtype);
Result:
| new_str |
|---|
| "llo" |
| 1 row |
substring()substring() returns a substring of the original string, starting at zero-based index start, with length length.
Syntax: substring(original, start [, length])
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
start |
An expression that evaluates to the zero-based starting index. |
length |
Optional. An expression that evaluates to a positive integer specifying how many characters to return. |
Notes:
start uses zero-based indexing. length is omitted, the function returns the substring from start to the end of original. null if original is null. start or length is null or negative. start is 0, the substring begins at the start of original. length is 0, an empty string is returned.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN substring('hello', 1, 3), substring('hello', 2)
$$) as (sub_str1 agtype, sub_str2 agtype);
Result:
| sub_str1 | sub_str2 |
|---|---|
| "ell" | "llo" |
| 1 row |
rTrim()rTrim() returns the original string with trailing whitespace removed.
Syntax: rTrim(original)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
Notes:
rTrim(null) returns null.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN rTrim(' hello ')
$$) as (right_trimmed_str agtype);
Result:
| right_trimmed_str |
|---|
| " hello" |
| 1 row |
lTrim()lTrim() returns the original string with leading whitespace removed.
Syntax: lTrim(original)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
Notes:
lTrim(null) returns null.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN lTrim(' hello ')
$$) as (left_trimmed_str agtype);
Result:
| left_trimmed_str |
|---|
| "hello " |
| 1 row |
trim()trim() returns the original string with both leading and trailing whitespace removed.
Syntax: trim(original)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
Notes:
trim(null) returns null.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN trim(' hello ')
$$) as (trimmed_str agtype);
Result:
| trimmed_str |
|---|
| "hello" |
| 1 row |
toLower()toLower() returns the original string converted to lowercase.
Syntax: toLower(original)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
Notes:
toLower(null) returns null.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN toLower('HELLO')
$$) as (lower_str agtype);
Result:
| lower_str |
|---|
| "hello" |
| 1 row |
toUpper()toUpper() returns the original string converted to uppercase.
Syntax: toUpper(original)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
Notes:
toUpper(null) returns null.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN toUpper('hello')
$$) as (upper_str agtype);
Result:
| upper_str |
|---|
| "HELLO" |
| 1 row |
reverse()reverse() returns a string with the order of all characters in the original string reversed.
Syntax: reverse(original)
Returns:
An agtype string.
Parameters:
| Name | Description |
|---|---|
original |
An expression that evaluates to a string. |
Notes:
reverse(null) returns null.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN reverse("hello")
$$) as (reverse_str agtype);
Result:
| reverse_str |
|---|
| "olleh" |
| 1 row |
toString()toString() converts an integer, floating-point number, or Boolean value to a string.
Syntax: toString(expression)
Returns:
A string.
Parameters:
| Name | Description |
|---|---|
expression |
An expression that evaluates to a number, Boolean, or string. |
Notes:
toString(null) returns null. expression is already a string, it is returned unchanged.Query:
SELECT *
FROM cypher('graph_name', $$
RETURN toString(11.5), toString('a string'), toString(true)
$$) as (float_to_str agtype, str_to_str agtype, bool_to_string agtype);
Result:
| float_to_str | str_to_str | bool_to_str |
|---|---|---|
| "11.5" | "a string" | "true" |
| 1 row |