See related
No related articles

String modifying workflow helpers

Last Update: Dec 2024 • Est. Read Time: 3 MIN
To check plan availability, see the pricing page.

String modification helpers allow you to adjust the appearance or formatting of a given string. For example, you can use a string helper to standardize customer names by capitalizing the first letter of each word. 

In the examples shown in this article, the string included after the helper name can be replaced by a standard JSON data path. For example, {{{capitalize 'abc'}}} could be changed to {{{capitalize steps.1.subject}}} to dynamically apply the transformation to a specific data field.

Use of these helpers will typically be aided in the use of a triple-stache wrapper (as opposed to a double), though this is not required.

In this article

Camel Case

{{camelCase}} converts a string into camelCase format, where characters in the first word are all non-capitalized, and each word after starts with a capitalized letter. 

  • {{{camelCase 'one two three'}}} resolves to the string "oneTwoThree"

Capitalize

{{capitalize}} converts the first character in a string to its capitalized version, and all remaining characters to non-capitalized versions.

  • {{{capitalize 'one two THREE'}}} resolves to the string "One two three"

Kebab Case

{{kebabCase}} converts a string into the kebab-case format, where hyphens separate words, and all letters are non-capitalized. 

  • {{{kebabCase 'one two three'}}} resolves to the string "one-two-three"

Lower Case

{{lowerCase}} converts all characters in a string to lower case, with all letters non-capitalized, and words separated on a space.

  • {{{lowerCase 'OneTwoThree'}}} resolves to the string "one two three"

Lower First

{{lowerFirst}} converts the first character in a string to its capitalized version.

  • {{{lowerFirst 'ONE TWO THREE'}}} resolves to the string "oNE TWO THREE"

Replace

{{replace}} finds matches for a search pattern and replaces them with a new value. The search pattern may be a string or use RegEx.

  • {{{replace 'one two five' search='five' newvalue='three'}}} resolves to the string "one two three"

  • {{{replace 'five five five' search='five' newvalue='three'}}} resolves to the string "three three three"

  • {{{replace '1ne tw2 three' search='1|2' flags='g' newvalue='o'}}} resolves to the string "one two three"

Slice

The /#fn:slice function helper takes a string input and returns a sliced version of that string, based on two specified indices. If the first index is not provided, it defaults to zero. If the second index is not provided, it defaults to the end of the string.

  • Given steps.1.name = "Bruce"
    /#fn:slice,steps.1.name,1,4 resolves to the string "ruc"
    /#fn:slice,steps.1.name,2 resolves to the string "uce"
    /#fn:slice,steps.1.name,,2 resolves to the string "Br"

Snake Case

{{snakeCase}} converts a string into snake_case format, where separated words are connected by an underscore, and all letters are non-capitalized. 

  • {{{snakeCase 'one two three'}}} resolves to the string "one_two_three"

Split

{{split}} breaks a string into an array of strings at a defined separator and returns one string at a defined index. This helper will not return a full array array.

  • {{{split 'one-two-three' separator='-' index=1}}} resolves to the string "two"

Start Case

{{startCase}} converts a string into Start Case format, where the first letter of each word is capitalized, all remaining letters are non-capitalized, and words are separated by spaces.

  • {{{startCase 'one two THREE'}}} resolves to the string "One Two Three"

To Lower

{{toLower}} converts all characters in a string into non-capitalized versions.

  • {{{toLower 'ONE TWO THREE'}}} resolves to the string "one two three"

To Upper

{{toUpper}} converts all characters in a string to their capitalized version.

  • {{{toUpper 'one two three'}}} resolves to the string "ONE TWO THREE"

Trim

{{trim}} removes leading and trailing whitespace in the string. You can also use the trimStart and trimEnd variation helpers.

  • {{{trim '   one two three   '}}} resolves to the string "one two three"

  • {{{trimStart '   one two three   '}}} resolves to the string "one two three   "

  • {{{trimEnd '   one two three   '}}} resolves to the string "   one two three"

Upper Case

{{upperCase}} converts all characters in a string to UPPER CASE, with all letters capitalized, and words separated on a space.

  • {{{upperCase 'OneTwoThree'}}} resolves to the string "ONE TWO THREE"

Upper First

{{upperFirst}} converts the first character in a string to its capitalized version.

  • {{{upperFirst 'one two THREE'}}} resolves to the string "One two THREE"

Related articles: