INTEGRITY Cloudflare Docs

String functions

Cloudflare Pipelines scalar function implementations are based on Apache DataFusion (via Arroyo) and these docs are derived from the DataFusion function reference.

ascii

Returns the ASCII value of the first character in a string.

ascii(str)

Arguments

Related functions: chr

bit_length

Returns the bit length of a string.

bit_length(str)

Arguments

Related functions: length, octet_length

btrim

Trims the specified trim string from the start and end of a string. If no trim string is provided, all whitespace is removed from the start and end of the input string.

btrim(str[, trim_str])

Arguments

Related functions: ltrim, rtrim

Aliases

char_length

Alias of length.

character_length

Alias of length.

concat

Concatenates multiple strings together.

concat(str[, ..., str_n])

Arguments

Related functions: concat_ws

concat_ws

Concatenates multiple strings together with a specified separator.

concat(separator, str[, ..., str_n])

Arguments

Related functions: concat

chr

Returns the character with the specified ASCII or Unicode code value.

chr(expression)

Arguments

Related functions: ascii

ends_with

Tests if a string ends with a substring.

ends_with(str, substr)

Arguments

initcap

Capitalizes the first character in each word in the input string. Words are delimited by non-alphanumeric characters.

initcap(str)

Arguments

Related functions: lower, upper

instr

Alias of strpos.

Arguments

left

Returns a specified number of characters from the left side of a string.

left(str, n)

Arguments

Related functions: right

length

Returns the number of characters in a string.

length(str)

Arguments

Aliases

Related functions: bit_length, octet_length

lower

Converts a string to lower-case.

lower(str)

Arguments

Related functions: initcap, upper

lpad

Pads the left side of a string with another string to a specified string length.

lpad(str, n[, padding_str])

Arguments

Related functions: rpad

ltrim

Trims the specified trim string from the beginning of a string. If no trim string is provided, all whitespace is removed from the start of the input string.

ltrim(str[, trim_str])

Arguments

Related functions: btrim, rtrim

octet_length

Returns the length of a string in bytes.

octet_length(str)

Arguments

Related functions: bit_length, length

repeat

Returns a string with an input string repeated a specified number.

repeat(str, n)

Arguments

replace

Replaces all occurrences of a specified substring in a string with a new substring.

replace(str, substr, replacement)

Arguments

reverse

Reverses the character order of a string.

reverse(str)

Arguments

Returns a specified number of characters from the right side of a string.

right(str, n)

Arguments

Related functions: left

rpad

Pads the right side of a string with another string to a specified string length.

rpad(str, n[, padding_str])

Arguments

Related functions: lpad

rtrim

Trims the specified trim string from the end of a string. If no trim string is provided, all whitespace is removed from the end of the input string.

rtrim(str[, trim_str])

Arguments

Related functions: btrim, ltrim

split_part

Splits a string based on a specified delimiter and returns the substring in the specified position.

split_part(str, delimiter, pos)

Arguments

starts_with

Tests if a string starts with a substring.

starts_with(str, substr)

Arguments

strpos

Returns the starting position of a specified substring in a string. Positions begin at 1. If the substring does not exist in the string, the function returns 0.

strpos(str, substr)

Arguments

Aliases

substr

Extracts a substring of a specified number of characters from a specific starting position in a string.

substr(str, start_pos[, length])

Arguments

translate

Translates characters in a string to specified translation characters.

translate(str, chars, translation)

to_hex

Converts an integer to a hexadecimal string.

to_hex(int)

Arguments

trim

Alias of btrim.

upper

Converts a string to upper-case.

upper(str)

Arguments

Related functions: initcap, lower

uuid

Returns UUID v4 string value which is unique per row.

uuid()

overlay

Returns the string which is replaced by another string from the specified position and specified count length. For example, overlay('Txxxxas' placing 'hom' from 2 for 4) → Thomas

overlay(str PLACING substr FROM pos [FOR count])

Arguments

levenshtein

Returns the Levenshtein distance between the two given strings. For example, levenshtein('kitten', 'sitting') = 3

levenshtein(str1, str2)

Arguments

substr_index

Returns the substring from str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. For example, substr_index('www.apache.org', '.', 1) = www, substr_index('www.apache.org', '.', -1) = org

substr_index(str, delim, count)

Arguments

find_in_set

Returns a value in the range of 1 to N if the string str is in the string list strlist consisting of N substrings. For example, find_in_set('b', 'a,b,c,d') = 2

find_in_set(str, strlist)

Arguments