Marwan
02/22/2024, 8:38 AMamount?string('#,##0.00;; decimalSeparator="." groupingSeparator=_')?replace("_", "'")
because I fail to set '
after groupingSeparator=
it always gives errors, any ideas how it should be done, without using ?replace
?Emily S
02/22/2024, 2:29 PM#,##0.00;; decimalSeparator="." groupingSeparator='
)` work? I think you are having an issue with setting '
because you are also using the same symbol as your open/close string delimeterMarwan
02/22/2024, 2:45 PMDavid B
02/22/2024, 8:10 PMamount?string('#,##0.00;; decimalSeparator="." groupingSeparator=''')
will test myself laterDavid B
02/22/2024, 8:11 PMMarwan
02/23/2024, 7:03 AM'#,##0.00;; decimalSeparator="." groupingSeparator='
and ''
as another argument.David B
02/26/2024, 12:28 AMStefan Reeder
02/27/2024, 12:47 PM<#function num value>
<#assign rawvalue = value?replace("$","")?replace(",","") />
<#if rawvalue?length gte 1>
<#return rawvalue?number />
<#else>
<#return 0 />
</#if>
</#function>
Then when I want to render a string, at least I know it's definitely a number I'm working with.
Then you can ${num({field})?string.("$#,##0.00")
or ${num({field})?string.("€#.##0,00")
or whatever else you need.
In the function you could use a regex to remove all non-numeric/decimal characters as well.Marwan
02/27/2024, 7:39 PM?replace(",", "")
here is not safe, because with some formats the comma could be a decimal separator, not a group separator.David B
02/27/2024, 8:52 PMDavid B
02/27/2024, 9:45 PMMarwan
02/28/2024, 7:18 AMMarwan
02/28/2024, 7:20 AMMarwan
02/28/2024, 7:21 AMMarwan
02/28/2024, 7:21 AMStefan Reeder
02/28/2024, 11:19 AMDavid B
02/28/2024, 8:13 PM^(\d+)([.,]\d+)?$
which would work on numbers like:
4294967295.00
4294967295,00
4294967295
Stefan Reeder
02/28/2024, 10:06 PMDavid B
02/28/2024, 10:34 PMleftMatch.replace(/[ ,.]/g,'')
)
Identifying the last .
,
is tricky, as sometimes it's the decimal char, like in 1,234.000
, 1.234,000
, or 1 234,000
, but other times it's just another thousands separator, like in 1,234,000
or 1.234.000
Then you get awkward strings like 1.000
or 1,000
. Could be 1 or 1000 depending on what locale is being used...David B
02/28/2024, 10:35 PM