Join us at Snowflake Summit June 26-29 in Las Vegas!

New String Functions Added to the Standard Library

Murali Pusala and Stefan Pabst

01 October 2021

less than a minute read

The Standard Library has been updated and expanded to include various new String functionalities to better handle and manipulate string data. New functions include:

NameDescription
string_joinConcatenates String or Character data.
string_replaceSearches for a string pattern and replaces it.
string_trimTrims string by deleting leading and trailing whitespaces.
concatoncatenates two strings.
char / byteReturns the character at a specific index/byte position.
num_chars / num_bytesCount the characters/bytes of a string.

A few examples seeing these new functions in action:

def output[1] = concat["Hello ", "World"]  // "Hello World"
def output[2] = string_join[", ",
    {(1, "a"); (2, "b"); (3, "c")}
] // "a, b, c"

Relation:

1"Hello World"
2"a, b, c"
def output[1] = string_trim["  This works "]  // "This works"
def output[2] = string_replace["rAI", 'r', 'R']  // "RAI"

Relation:

1"This works"
2"RAI"

def output[1] = num_chars["中文例子"]  // 4
def output[2] = char["grün", 3]  // 'ü'

Relation:

14
2'ü'

Related Posts

Get Early Access

Join our community, keep up to date with the latest developments in our monthly newsletter, and get early access to RelationalAI.