Articles on: Expression language

String functions

Uppercase

To display data field value in uppercase, use following expression.
{% uppercase({dataFieldName}) %}


Lowercase

To display data field value in lowercase, use following expression.
{% lowercase({dataFieldName}) %}


Capitalize

Uppercase the first character of each word in a string.
{% capitalize({dataFieldName}) %}


Split

The split(delimiter, string) function allows to split string into an array.
{% split("_", "Some_string") %} => ["Some", "string"]


Replace

The str_replace([string: search], [string: replace], [string: the original string]) function replaces all occurrences of a substring within a string.
{% str_replace("dog", "cat", "this is dog") %}
This expression output is: this is cat

The first two parameters can also be arrays that specify search and replace values e.g. {% str_replace(["dog", " is"], ["cat", " is not"], "this is dog") %} => this is not cat

Substring

The substr ( string $string , int $offset , int|null $length = null ) returns the portion of string specified by the offset and length parameters.

{% substr("This is test", 0, 2) %} // Result: Th
{% substr("This is test", 1, 2) %} // Result: hi
{% substr("This is test", -2) %} // Result: st


Count

The count({stringData}) returns the length of the string
{% count("abcd") %} // Result: 4

Updated on: 18/12/2022

Was this article helpful?

Share your feedback

Cancel

Thank you!