51黑料不打烊

String functions

length (text or buffer)

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

recommendation-more-help

Example:

length( hello )

Returns: 5

lower (text)

Converts all alphabetical characters in a text string to lowercase.

Example:

lower( Hello )

Returns: hello

capitalize (text)

Converts the first character in a text string to uppercase.

Example:

capitalize( workfront )

Returns: Workfront

startcase (text)

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

Example:
startcase( hello WORLD )

Returns: Hello World

ascii (text; [remove diacritics])

Removes all non-ascii characters from a text string.

Examples:

  • ascii( 奥臎辞拧谤膷办艡蹿啪谤媒辞谩苍铆迟茅 )

Returns: Workfront

  • ascii( 臎拧膷艡啪 ; true )

Returns: escrz

replace (text;search string; replacement string)

Replaces the search string with the new string.

Example:

replace( Hello World ; Hello ; Hi )

Returns: Hi World

Regular expressions (enclosed in /.../) can be used as search string with a combination of flags (such as g, i, m) appended:

Example:

Replace

All of these numbers X X X X are 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. This is 1-indexed.

Examples:

Variable value

Returns: Phone number +420777111222

Variable return

Returns: Phone number: +420777111222

CAUTION
Do not use named capture groups such as / is (?<number>\d+)/ in the replacement string argument. Doing so results in an error.

For more information on regular expressions, see Text parser.

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.

Example:

upper( Hello )

Returns: HELLO

substring (text; start;end)

Returns a portion of a text string between the 鈥渟tart鈥 position and 鈥渆nd鈥 position.

Examples:

  • substring( Hello ; 0 ; 3)

    Returns: Hel

  • substring( Hello ; 1 ; 3 )

    Returns: el

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 that is searched for is not there. The start value indicates where in the string the search should begin.

Examples:

  • indexOf( Workfront ; o )

    Returns: 1

  • indexOf( Workfront ; x )

    Returns: -1

  • indexOf( Workfront ; o ; 3 )

    Returns: 6

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.

Examples:

  • toBinary( Workfront )

    Returns: 57 6f 72 6b 66 72 6f 6e 74

  • toBinary( V29ya2Zyb250 ; base64 )

    Returns: 57 6f 72 6b 66 72 6f 6e 74

toString (value)

Converts any value to a string.

encodeURL (text)

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

decodeURL (text)

Decodes special characters in a URL to text.

Example:
decodeURL( Automate%20your%20workflow )

Returns: Automate your workflow

escapeHTML (text)

Escapes all HTML tags in text.

Example:

escapeHTML( <b>Hello</b> )

Returns: &lt;b&gt;Hello&lt;/b&gt;

escapeMarkdown(text)

Escapes all Markdown tags in text.

Example:

escapeMarkdown( # Header )

Returns: &#35; Header

stripHTML (text)

Removes all HTML tags from text.

Example:

stripHTML( <b>Hello</b> )

Returns: Hello

contains (text; search string)

Verifies whether text contains the search string.

Examples:

  • contains( Hello World ; Hello )

    Returns: true

  • contains( Hello World ; Bye )

    Returns: false

split (text; separator)

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

Example:

split( John, George, Paul ; , )

md5 (text)

Calculates the md5 hash of a string.

Example:

md5( Workfront )

Returns: 1448bbbeaa7a9b8091d426999f1f666b

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: 鈥渉别虫鈥 (default), 鈥渂补蝉别64鈥 or 鈥渓atin1.鈥

Example:

sha1( workfront )

Returns: b2b30b8ae1f9e5b40fbb0696eaabdbfd8d0c087f

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

Calculates the sha256 hash of a string. If the key argument is specified, sha256 HMAC hash is returned instead. Supported encodings: 鈥渉别虫鈥 (default), 鈥渂补蝉别64鈥 or 鈥渓补迟颈苍1鈥.>

Example:

sha256( workfront )

Returns: ed3d7397eec7b94453035b67ba4468c883ee3bedeb57137f7371f2e0cf5e2bbc

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:

  • 鈥渉别虫鈥 (default)
  • 鈥渂补蝉别64鈥
  • 鈥渓补迟颈苍1鈥

Supported key encodings:

  • 鈥渢ext鈥 (default)
  • 鈥渉别虫鈥
  • 鈥渂补蝉别64鈥 or 鈥渂inary鈥

When using 鈥渂inary鈥 key encoding, a key must be a buffer, not a string.

Example:

sha512(workfront)

Returns: 789ae41b9456357e4f27c6a09956a767abbb8d80b206003ffdd1e94dbc687cd119b85e1e19db58bb44b234493af35fd431639c0345aadf2cf7ec26e9f4a7fb19

base64 (text)

Transforms text to base64.

Example:

base64( workfront )

Returns: d29ya2Zyb250==

7e1891ad-4d59-4355-88ab-a2e62ed7d1a3