I'm very new to TWIG.
I have a string ₹1,324, or ₹324 compare it with integer value 3000, so I want to trim characters ₹ and ,
I know how to trim one character.
{% if foo |trim('₹') |number_format > 3000 %}
help me to how to do it.
thanks in advance.
Use php
str_replacestr_replace([",", "₹"], "", $str);replace for twig
{% if foo |replace({'₹':'', ',':''}) |number_format > 3000 %}https://twig.symfony.com/doc/2.x/filters/replace.html
So how you would ideally do it would be pass in just a regular integer to your twig template, do the comparison & then if you need to display the whole string on the page, prefix the
number_formatto get the comma and if you wish decimal places.https://twig.symfony.com/doc/2.x/filters/number_format.html