Skip to main content

String functions

String functions let you modify and transform string data, also known as text. Use a string function to, for example, change capitalization, remove diacritics and accent marks, combine, split, encode, or decode text. Below is a list of supported string functions and a description of each.

ascii (text; [remove diacritics])

Removes all non-ascii characters from a text string.

ascii( ěMščařžkýáeíé)

= Make

ascii( ěščřž ; true )

= escrz

base64 (text)

Transforms text to base64.

base64( Make )

=TWFrZQ==

Tip

Combine the toBinary() and toString() functions to transform base64 encoded text to plain text, as seen below:

toString( toBinary( TWFrZQ== ; base64 ) )

= Make

capitalize (text)

Converts the first character in a text string to uppercase.

capitalize(make)

= Make

contains (text; search string)

Verifies if text contains the search string.

contains( Hello World ; Hello )

= true

contains( Hello World ; Bye )

= false

decodeURL (text)

Decodes special characters in URL to text.

decodeURL( Automate%20your%20workflow )

= Automate your workflow

encodeURL (text)

Encodes special characters in a text to a valid URL address.

escapeHTML (text)

Escapes all HTML tags in text.

escapeHTML( <b>Hello</b> )

= &lt;b&gt;Hello&lt;/b&gt;

indexOf (string; value; [start])

Returns the position of the first occurrence of a specified value in a string. This method returns '-1' if the value searched for never occurs.

indexOf(Make; k )

= 2

indexOf(We love Make ; x )

= -1

indexOf(We love Make; e ; 7 )

= 11

length (text or buffer)

Returns the length of text string (number of characters) or binary buffer (buffer size in bytes).

length( hello )

= 5

lower (text)

Converts all alphabetical characters in a text string to lowercase.

lower( Hello )

= hello

md5 (text)

Calculates the md5 hash of a string.

md5(Make)

= 529a05ca6c1263aab080ec4f20754411

replace (text; search string; replacement string)

Replaces the search string with the new string.

replace( Hello World ; Hello ; Hi )

= Hi World

Regular expressions (enclosed in /.../) can be used as search string with a combination of flags (like gim) appended:

string_functions_1.png

= All these numbers X X X X will be replaced with X

The replacement string can include the following special replacement patterns:

$&

Inserts the matched substring

$n

Where n is a positive integer less than 100, inserts the nth parenthesized submatch string. Note that this is 1-indexed

string_functions_2.png

= Phone number is +420777111222

string_functions_3.png

= Phone number: +420777111222

Warning

Do not use named capture groups like / is (?<number>\d+)/ in the replacement string argument as this will throw an error.

replaceEmojiCharacters (text)

Replaces emoji characters with the new string.

replaceemoji.png

sha1 (text; [encoding]; [key])

Calculates the sha1 hash of a string. If the key argument is specified, sha1 HMAC hash is returned instead. Supported encodings: hex (default), base64 or latin1.

sha1(Make)

= a94431ee22f05f141107f9355ed3127d0f0c4d5a

sha256 (text; [encoding]; [key]; [key encoding])

Calculates the sha256 hash of a string. If the key argument is specified, sha256 HMAC hash is returned instead. Supported encodings: hex (default), base64 or latin1.

sha256(Make)

= ccdd25d4230fb997a7ee1166f8afabd157248eb812ea55ec7c3d1b7c8af7fa11

sha512 (text; [output encoding]; [key]; [key encoding])

Calculates the sha512 hash of a string. If the key argument is specified, sha512 HMAC hash is returned instead. Supported encodings: hex (default), base64 or latin1. Supported key encodings: text (default), hex, base64 or binary. When using binary key encoding, a key must be a buffer, not a string.

sha512( Make )

= e8000cd0fb8fae18caa8daa677269b0034380d3ec549e0113a0722d8b8dc05b0f7037f33f32fa09f906b2f1d7c43f2689a55d79aadf6bf09dd93f79407424d34

split (text; separator)

Splits a string into an array of strings by separating the string into substrings.

split( John, George, Paul ; , )

startcase (text)

Capitalizes the first letter of every word and lower cases all other letters.

startcase( hello WORLD )

= Hello World

stripHTML (text)

Removes all HTML tags from text.

stripHTML( <b>Hello</b> )

= Hello

substring (text; start; end)

Returns a portion of a text string between the "start" position and "the end" position.

substring( Hello ; 0 ; 3 )

= Hel

substring( Hello ; 1 ; 3 )

= el

toBinary (value)

Converts any value to binary data. You can also specify encoding as a second argument to apply binary conversions from hex or base64 to binary data.

toBinary(Make)

= 4d 61 6b 65

toString(toBinary(TWFrZQ==;base64)

= Make

toString (value)

Converts any value to a string.

trim (text)

Removes space characters at the start or end of the text.

upper (text)

Converts all alphabetical characters in a text string to uppercase.

upper( Hello )

= HELLO