String Formatting
CrossEngage offers two string formatting functions:
trim
- used to remove whitespace around a stringsubstring
- used to display a substring of an existing string
trim Function
The trim
helper function removes white spaces from the start and end of a string. The syntax of this formatting function is:
Property | Description |
| Any user or event attribute or any information extracted through any of the helper functions. e.g. |
Removing the white space around an email attribute
For the example below, we use john.doe@crossengage.io
as the value of the user's email attribute.
Once the function is evaluated, it displays john.doe@crossengage.io
in the section where it is used in the message.
Removing the white space around a product name field
Using the helper function #findProduct
, we search for a particular sku
and format the result's [properties.name]
attribute. For the example below, we use iPhone 8 Plus
as the value of the product's name.
Once the function is evaluated, it displays iPhone 8 Plus
in the section where it is used in the message.
substring Function
To extract a substring from a text field, we can use the substring
function. This can be quite useful in breaking down text fields such as address, IBAN, or Business Unit, where different parts of the string might have Independent meaning.eaning.
Property | Description |
| Required. Any user or event attribute or any information extracted through any of the helper functions. |
| Required. The index of the character in the original string where the substring starts. e.g. |
| Required. The number of characters the substring extracts from the original string. e.g. |
Last updated