OPAL String Functions

String functions process strings as input, or provide strings as output.

Function

Description

array_to_string

Cast all values in an array to string and concatenate them, optionally adding a separator between each value.

check_json

Check that the argument value is a valid JSON document.

concat_strings

Return the concatenation of all string arguments.

contains

Returns true if the str string contains the expr string (case-sensitive).

decode_base64

DecodeBase64 decodes a base64 encoded input

decode_uri

Replace %-encoded escape sequences in a string with unencoded plain text.

decode_uri_component

Replace all %-encoded escape sequences in a string with unencoded plain text.

detect_browser

Identify the browser used for a web request from its User-Agent header.

editdistance

Returns the Levenshtein distance between str1 and str2.

embed_sql_params

Embed parameters into the given prepared SQL statement by replacing occurrences of the placeholder character ‘?

encode_base64

EncodeBase64 encodes the input in the base64 format

encode_uri

Replace certain characters in a string with %-encoded escape sequences.

encode_uri_component

Replace certain characters in a string with %-encoded escape sequences.

ends_with

Returns true if string str ends with string expr.

format_time

Format a timestamp column according to the specified format string.

get_regex

Returns a string that matches the given regular expression if a match exists.

int64_to_ipv4

Converts integer-encoded IPv4 addresses to dotted-quad notation.

ipv4_address_in_network

Test whether an IPv4 address is in a given subnet.

label

Returns the label of a link.

left

Returns a leftmost substring of its input.

like

Returns true if subject matches pattern (case-sensitive).

lower

Return the input string in lowercase.

lpad

Left pads a string with characters from another string, default pad string is whitespace

ltrim

ltrim removes leading characters from a string.

parse_csv

Parses an input string as character-separated values, where the default separator is a comma (comma-separated values.

parse_kvs

Returns an object of key=value pairs extracted from an input string.

parse_timestamp

Parse a string value, whose format is specified by the format argument, as a timestamp.

pivot_array

Converts an array of “key”-“value” pairs into an object with key-value attributes.

position

Searches for the first occurrence of the second argument (needle) in the first argument (haystack).

regex

Coerce a string literal to a regular expression.

replace

Replaces all instances of the substring in the input string with a provided value.

replace_regex

Replaces all instances of a matched regex pattern in the input string with a provided value.

right

Returns a rightmost substring of its input.

rpad

Right pads a string with characters from another string, default pad string is whitespace

rtrim

rtrim removes trailing characters from a string.

sha2

Returns a hex-encoded string containing the N-bit SHA-2 message digest, where N is the specified output digest size.

split

Splits the string into an array, based on the separator.

split_part

Splits a given string at a specified delimiter character and returns the requested part.

starts_with

Returns true if string starts with expr.

string

Generate a string representation of the argument value.

string_agg

Returns concatenated input values, separated by the delimiter.

string_agg_distinct

Returns concatenated input values, separated by the delimiter.

string_null

Returns a null value of type string.

substring

Extracts characters from a string, starting at an index.

tokenize

Splits the string into an array based on separator, which is treated as a set of characters.

tokenize_part

Tokenizes the input string using the delimiter and returns the requested part.

trim

trim removes leading and trailing characters from a string.

unpivot_array

Convert an object into an array of “key”-“value” pairs.

upper

Return the input string in uppercase.

variant_type_name

Resolves the data type of a variant column so that column may be typed for better performance.