String Functions¶
Quick Reference¶
| Function | Description |
|---|---|
ENV | Returns the value of an environment variable. Returns empty ... |
INITCAP | Converts the first letter of each word to upper case and the... |
INSTR | Returns the position of the first occurrence of a substring ... |
LENGTH | Returns the length of a string or the number of elements in ... |
LOWER | Converts a string to lower case. |
LPAD | Pads the left side of a string with another string to a cert... |
LTRIM | Removes leading whitespace from a string. |
REGEXP_REPLACE | Replaces each substring that matches a regular expression wi... |
REGEXP_SUBSTR | Returns the first substring that matches the given regular e... |
REPLACE | Replaces all occurrences of a substring with a replacement s... |
REVERSE | Reverses a string. |
RPAD | Pads the right side of a string with another string to a cer... |
RTRIM | Removes trailing whitespace from a string. |
SPLIT | Splits a string by the given delimiter. |
SUBSTR | Returns a substring from a string starting at a given positi... |
TRIM | Removes leading and trailing whitespace from a string. |
UPPER | Converts a string to upper case. |
[||](# |
Function Details¶
ENV¶
Returns the value of an environment variable. Returns empty string if not set.
Parameters:
| Name | Type | Description |
|---|---|---|
name | STRING | The name of the environment variable |
default_value | STRING | Default value if variable is not set (optional) |
Returns: STRING - The environment variable value or default
Examples:
INITCAP¶
Converts the first letter of each word to upper case and the rest to lower case.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to convert |
Returns: STRING - The converted string
Examples:
INSTR¶
Returns the position of the first occurrence of a substring in a string (1-based). Returns 0 if not found.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to search |
substring | STRING | The substring to search for |
Returns: INTEGER - The position of the substring, or 0 if not found
Examples:
LENGTH¶
Returns the length of a string or the number of elements in an array.
Parameters:
| Name | Type | Description |
|---|---|---|
input | ANY | The string or array to measure |
Returns: INTEGER
Examples:
LOWER¶
Converts a string to lower case.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to convert |
Returns: STRING - The lower-cased string
Examples:
LPAD¶
Pads the left side of a string with another string to a certain length.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The original string |
totalLength | NUMBER | The desired total length |
padStr | STRING | The string to pad with |
Returns: STRING - The padded string
Examples:
LTRIM¶
Removes leading whitespace from a string.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to trim |
Returns: STRING - The left-trimmed string
Examples:
REGEXP_REPLACE¶
Replaces each substring that matches a regular expression with a replacement string.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to search |
regex | STRING | The regular expression |
replacement | STRING | The replacement string |
Returns: STRING - The string with regex replacements
Examples:
REGEXP_SUBSTR¶
Returns the first substring that matches the given regular expression.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to search |
regex | STRING | The regular expression |
Returns: STRING - The first matching substring, or empty if none
Examples:
REPLACE¶
Replaces all occurrences of a substring with a replacement string.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to search |
target | STRING | The substring to replace |
replacement | STRING | The replacement string |
Returns: STRING - The string with replacements
Examples:
REVERSE¶
Reverses a string.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to reverse |
Returns: STRING - The reversed string
Examples:
RPAD¶
Pads the right side of a string with another string to a certain length.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The original string |
totalLength | NUMBER | The desired total length |
padStr | STRING | The string to pad with |
Returns: STRING - The padded string
Examples:
RTRIM¶
Removes trailing whitespace from a string.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to trim |
Returns: STRING - The right-trimmed string
Examples:
SPLIT¶
Splits a string by the given delimiter.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to split |
delimiter | STRING | The delimiter string |
Returns: ARRAY<STRING> - The list of split parts
Examples:
SUBSTR¶
Returns a substring from a string starting at a given position with optional length.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to extract from |
start | NUMBER | The starting position (1-based) |
length | NUMBER | The length of the substring (optional) |
Returns: STRING - The extracted substring
Examples:
TRIM¶
Removes leading and trailing whitespace from a string.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to trim |
Returns: STRING - The trimmed string
Examples:
UPPER¶
Converts a string to upper case.
Parameters:
| Name | Type | Description |
|---|---|---|
input | STRING | The string to convert |
Returns: STRING - The upper-cased string
Examples:
||¶
Concatenates two strings.
Parameters:
| Name | Type | Description |
|---|---|---|
left | STRING | The left string |
right | STRING | The right string |
Returns: STRING - The concatenated string
Examples: