I want to do something like this:
{% set c=a+b %}
Where a and b are strings.
How can I do it?
Combining strings Twig provides two ways to combine strings together: You can concatenate them using the tilde ( ~ ) operator, or you can inject a string into the middle of another string using string interpolation.
Use the tilde character ~ to concatenate string and/or variables. ~: Converts all operands into strings and concatenates them.
The way to do it is:
{% set c = a ~ b %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With