On Lucee 5.x: does anyone know how NOT to get a sp...
# lucee
s
On Lucee 5.x: does anyone know how NOT to get a space between the minus sign and the negative number when using LSNumberFormat? So I want a negative number to show as "-7" and NOT "- 7". I am just not getting it I think, trying to work around this 😉
To answer myself, after an extra round of testing and trying out masks:
Trim(LSNumberFormat(elem.negativeValue, "_9,999", "nl_NL"))
a
What's an example of going wrong? I can't work out how to end up with the extra space?
s
Trim(LSNumberFormat(-7, "_9,999", "nl_NL"))
gives you -7 but
Trim(LSNumberFormat(-7, "9,999", "nl_NL"))
gives you - 7 as per the defaults of the function Apparently the underscore does the trick ;-)
_
and
9
are synonymous in a format mask.
Or: are supposed to be.
s
For me, this did the trick, I got consistent results with an extra space in the Dutch locale if I did not include the underscore for negative numbers. So it is weird that TryCF is coherent, but our Lucee installation is not?
It might be that we're on a somewhat older version of Lucee, hence we're seeing this. Plan is to move to a newer version, maybe even 6, during this year.
✅ 1
a
Sure. Might be an old bug
But also... I always like to understand WHY something has fixed something, before concluding "that fixed it".
👍🏼 1
d
I'm intrigued that trim() worked, like the '-' is meta. #nicefind... other wise I would have just used a reereplace regex [[punct]] or replace(string,'-','','all') - or inversed the negative and then put it back... with number functions... #interesting edge case
what exact version of lucee 5.x?