Using string manipulation in placeholders and exressions

Sometimes you might want to manipulate certain information you are sending via a placeholder. This article shows an example of how to extract substrings from an expression you are sending:

The placeholder is composed of the expression you want to use (="my.expression") and the definition of the substring. It looks like this:

{my.expression|substr:X:Y}  where X is the start index and Y is the end index.

Now, let's have a look at some examples. We will use the number called by the customer and extract different snippets:

{call.to} = 493056829742

From the number 493056829742 we now want to remove the country code:

{call.to|substr:2} = 3056829742

If we only want to extract the last 3 digits, we'll use:

{call.to|substr:-3} = 742

If we want to extract a snippet starting and ending at a certain digit, we insert start and end index:

{call.to|substr:3:8} = 056829  Note that we start counting at 0.

 

Have more questions? Submit a request