evilknivel
(Evilknivel)
1
Hi at all,
i have some problems to extract a float out of a given string it always returning a list with to values.
Can someone give me a hint pleased?
{% set value = 'Neuer Saldo: 210,54 EUR' %}
{{ value | regex_findall_index('Saldo: (-*[0-9]+,?[0-9]{2})') }}
Troon
(Troon)
2
For a numeric float that you can use in template calculations, you’ll need UK/US style decimal points, so:
{% set value = 'Neuer Saldo: 210,54 EUR' %}
{{ value | replace(',','.') | regex_findall_index('Saldo: (-*[0-9]+.?[0-9]{2})') }}
evilknivel
(Evilknivel)
3
Thank you very much i am a bit disapointed that i was not able to find this simple solution.
But now it works pretty nice