Table of Contents

Formulas - String

Sofia Teran Updated by Sofia Teran

String

Formulas available:

  • Capitalize
  • Contains
  • Length
  • Lower
  • Replace
  • Slice
  • Split
  • Title
  • ToString
  • Upper
Examples of use case of String formulas:

Capitalize

The first lowercase letter of the text will be converted to uppercase letter.

Let's see the result of the formula Capitalize in the text "hello landbot":

Capitalize("hello landbot")

Contains

Let's take a look on this example:

We established a text block Question asking which is the client's favorite startup and he answered "landbot", then we configure the formula Contains, so if the user answered "landbot", it'll come out through the green line (true) and if he answered something else, it'll come out through the red line (false):

Contains(@text,"landbot")

Length

We wanted to get the length of the text "welcome to landbot" and this is how we made it:

Length(@text)
Keep in mind that the white spaces between words will also be counted!

Lower

Let's take a look in the next example, where email is our variable and we want to make sure is in lower case for validation.

Lower(@email)

Replace

We replace the "a" of hahaha for "e" and this is how we made it:

Replace(text, old, new)

Slice

We want to extract some consecutive elements from our text "welcome to landbot":

Slice(@text,1,9)

Split

For example, get a list out of options selected in Multiple choice:

Split(@options,", ")

Title

Here's an example: we established a text block Question asking where is Spain and the first character in each word was converted to capital (uppercase) letter and remaining characters to lowercase.

Title(@text)

ToString

We want to transform number's " . " (dots) into " , " (commas) ๐Ÿค“:

  • Turn the number from theย Numberย format into theย Stringย format
ToString(@number)
Make sure to save the result in theย Stringย format, and add the variable in the number format in the formula!

Upper

We established a text block Question asking: "What would you write in the sand if you get lost in an Island? And the answer was "help" and our formula converted the text to all uppercase letters.

Upper(@text)

How did we do?

Formulas - Object

Contact