String functions
This page goes over the string functions in Upsolver.
BASE64_DECODE
BASE64_DECODE
Decode a base 64 string into a string.
value | result |
|
|
|
|
BYTES_SUBSTRING
BYTES_SUBSTRING
Returns a substring of the input, using the offsets in bytes of the UTF-8 encoded byte representation. Partial characters and invalid UTF-8 code points are removed from the result.
Inputs
value - Value to substring
Properties
Start Index - The inclusive start index in bytes
End Index - The exclusive end index in bytes
value | Start Index | End Index | result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JOIN_ARRAYS
JOIN_ARRAYS
Joins any number of arrays by index using a MessageFormat pattern.
Properties
Format String - The format string where
{n}
prints the nth input.For example, the pattern
'{0}.{0}.{1}'
on the inputs'a'
and'b'
will result in the string'a.a.b'
MD5
MD5
Hashes the input using MD5.
input | result |
|
|
PRESTO_SPLIT
PRESTO_SPLIT
This function returns the given string split by the provided delimiter.
Syntax
PRESTO_SPLIT(STRING,DELIMITER)
Arguments
STRING
A sequence of characters.
DELIMITER
A sequence of one or more characters for specifying the boundary between
separate, independent regions in plain text.
Returns
The given string split by the provided delimiter.
Examples
String | Delimiter | Result |
'a""b' | '"' | "a", , "b" |
'-a-bc-d-' | '-' | , "a", "bc", "d", |
"~~a~~b~~" | "~~" | , "a", "b", |
'Abra&Cadabra' | '&' | "Abra", "Cadabra" |
REGEX
REGEX
Matches the regular expression on the input string. Returns the escape groups if any exists or the original string if none exists.
Properties
Pattern - Regular Expression Pattern
input | Pattern | result |
|
|
|
REGEX_MATCH_POSITION
REGEX_MATCH_POSITION
Matches the regular expression on the input string and returns the index of the first match.
Inputs
value
startPosition
Properties
Pattern - Pattern to search for
REGEX_NAMED_GROUPS
REGEX_NAMED_GROUPS
Matches the regular expression on the input string. Returns record with field names and group names.
Properties
Pattern - Regular Expression Pattern
All Matches - Return all the matches of the pattern, and not only the first one
Filter Empty - Filter out empty matches
input | Pattern | All Matches | Filter Empty | result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
REPLACE
REPLACE
Replace substrings within a string.
Properties
Pattern - Pattern to replace (regex)
Replacement - Replacement string
value | Pattern | Replacement | result |
|
|
|
|
|
|
|
|
|
|
|
|
SHA1
SHA1
Hashes the input using SHA-1.
input | result |
|
|
SHA256
SHA256
Hashes the input using SHA-256.
input | result |
|
|
SPLIT
SPLIT
Returns an error message indicating that SPLIT has been deprecated.
SPLIT_DELIMITER_FIRST
SPLIT_DELIMITER_FIRST
Returns the given string split by the provided delimiter.
Syntax
SPLIT_DELIMITER_FIRST(DELIMITER, STRING)
Arguments
DELIMITER
A sequence of one or more characters for specifying the boundary between
separate, independent regions in plain text.
STRING
A sequence of characters.
Returns
The given string split by the provided delimiter.
Examples
Delimiter | Input String | Result |
|
|
|
|
|
|
|
|
|
|
|
|
SPLIT_TO_RECORD
SPLIT_TO_RECORD
Returns the given string split by the provided delimiter.
Properties
Field Names
Delimiter
Filter Empty Values
value | Field Names | Delimiter | Filter Empty Values | result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STRING_FORMAT
STRING_FORMAT
Format any number of inputs into a string using the given format.
Properties
Format String - The format string where
{n}
prints the nth input.For example, the pattern
'{0}.{0}.{1}
' on the inputs'a'
and'b'
will result in the string'a.a.b'
inputs | Format String | result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
STRING_LENGTH
STRING_LENGTH
Gets the length of the string.
input | result |
|
|
|
|
STRIP_MARGIN
STRIP_MARGIN
For each line remove prefix of control or whitespace characters followed by the given margin char.
Properties
Margin Char
input | Margin Char | result |
|
|
|
STRIP_PREFIX
STRIP_PREFIX
Remove the given prefix string from the beginning of the string.
Properties
Prefix
input | Prefix | result |
|
|
|
|
|
|
STRIP_SUFFIX
STRIP_SUFFIX
Remove the given suffix string from the end of the string.
Properties
Suffix
input | Suffix | result |
|
|
|
|
|
|
STRPOS
STRPOS
Returns the starting position of the first instance of a given substring within a string.
Syntax
STRPOS(STRING, SUBSTRING)
Arguments
STRING
The sequence of characters to search.
SUBSTRING
The substring to search for.
Returns
Returns the starting position of the first instance of SUBSTRING
in STRING
. Positions start from 1
. If no instance is found, 0
is returned.
Examples
STRING | SUBSTRING | Output |
---|---|---|
All happy families are alike | all | 0 |
All happy families are alike | All | 1 |
All happy families are alike | are | 20 |
All happy families are alike |
| 1 |
|
| 1 |
| word | 0 |
| word |
|
SUBSTRING
SUBSTRING
Returns a string that is a substring of the given string.
Inputs
value
startPosition
endPosition
value | startPosition | endPosition | result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TOP_PRIVATE_DOMAIN
TOP_PRIVATE_DOMAIN
Get the top private domain from a domain name.
value | result |
|
|
|
|
|
|
TO_LOWER
TO_LOWER
Converts the string to lowercase letters.
input | result |
|
|
TO_UPPER
TO_UPPER
Converts the string to uppercase letters.
input | result |
|
|
TRANSLATE
TRANSLATE
Translates the given value using a given dictionary.
Properties
Dictionary
Keep Values Without Translation - Whether to keep values that have that are not mapped to a value in the feature
Empty As Null - If set, empty values will be treated as null
input | Dictionary | Keep Values Without Translation | Empty As Null | result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TRIM
TRIM
Returns the given string without leading or trailing whitespaces.
input | result |
|
|
|
|
|
|
|
|
TRIM_CHARS
TRIM_CHARS
Returns the given string without leading or trailing characters.
Properties
Characters
input | Characters | result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
URL_DECODE
URL_DECODE
Decode url encoded text.
input | result |
|
|
|
|
URL_ENCODE
URL_ENCODE
Encode text to url encoded format.
input | result |
|
|
|
|
URL_PARSER
URL_PARSER
Parses the URI/URL into its component parts.
value | result |
"https://www.domain.com/page.html" | {"scheme": "https", "authority": "www.domain.com", "host": "www.domain.com", "path": "/page.html"} |
"https://user:pass@www.domain.com:80/page.html?query#fragment" | {"scheme": "https", "user_info": "user:pass", "authority": "user:pass@www.domain.com:80", "host": "www.domain.com", "port": 80, "path": "/page.html", "query": "query", "fragment": "fragment"} |
"user:pass@www.domain.com/page.html?query" | {"user_info": "user:pass", "authority": "user:pass@www.domain.com", "host": "www.domain.com", "path": "/page.html", "query": "query"} |
"www.domain.com/page.html#fragment" | {"authority": "www.domain.com", "host": "www.domain.com", "path": "/page.html", "fragment": "fragment"} |
"/www.domain.com" | {"path": "/www.domain.com"} |
UUID_GENERATOR
UUID_GENERATOR
Returns UUID.
Inputs
hash - Value for extra randomness
Last updated