String functions
GQL offers string functions to perform operations such as extracting substrings, trimming, folding, and normalizing strings. Let’s look at them in detail.
Substring functions
GQL allows the extraction of substrings from either the left or right side, with a specified length.
For example, here’s how you can obtain the first five letters of a sentence:
GQL:
RETURN LEFT("Hello GQL", 5)
The query returns "Hello"
.
This is how to extract GQL
using the RIGHT
function:
GQL:
RETURN RIGHT("Hello GQL", 3)
The query returns "GQL"
as the result, which is the last three characters.
The LEFT
and RIGHT
functions also can be applied to a sub-byte string:
GQL:
RETURN LEFT(x'1F2F3F', 2)
The query returns x'1F2F'
, extracting a byte string with a length of 2 bytes.
Uppercase and lowercase
To convert all letters to uppercase or lowercase, GQL provides the UPPER...