String functions
Modified on Thu, 30 May at 10:33 AM
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.
Removes all non-ascii characters from a text string.
ascii(
ěMščařžkýáeíé)
= Make
ascii(
ěščřž ;
true
)
= escrz
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
Converts the first character in a text string to uppercase.
capitalize(make)
= Make
Verifies if text contains the search string.
contains(
Hello World ;
Hello )
= true
contains(
Hello World ;
Bye )
= false
Decodes special characters in URL to text.
decodeURL(
Automate%20your%20workflow )
= Automate your workflow
Encodes special characters in a text to a valid URL address.
Escapes all HTML tags in text.
escapeHTML(
<b>Hello</b> )
= <b>Hello</b>
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
Returns the length of text string (number of characters) or binary buffer (buffer size in bytes).
length(
hello )
= 5
Converts all alphabetical characters in a text string to lowercase.
lower(
Hello )
= hello
Calculates the md5 hash of a string.
md5(
Make)
= 529a05ca6c1263aab080ec4f20754411
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 g
, i
, m
) appended:
= 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 |
| Where n is a positive integer less than 100, inserts the nth parenthesized submatch string. Note that this is 1-indexed |
= Phone number is +420777111222
= 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.
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
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
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
Splits a string into an array of strings by separating the string into substrings.
split(
John, George, Paul ;
, )
Capitalizes the first letter of every word and lower cases all other letters.
startcase(
hello WORLD )
= Hello World
Removes all HTML tags from text.
stripHTML(
<b>Hello</b> )
= Hello
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
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
Converts any value to a string.
Removes space characters at the start or end of the text.
Converts all alphabetical characters in a text string to uppercase.
upper(
Hello )
= HELLO
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article