Under Lucee 5.3.9.141, I'm getting an unexpected r...
# lucee
d
Under Lucee 5.3.9.141, I'm getting an unexpected results with
isNumeric()
with a value run through the
numberFormat()
function. I would expect the following code to return
true
, but it's returning `false`:
Copy code
dump(isNumeric(numberFormat(-2360, "9,999.9")));
However, all of the following variations do return `true`:
Copy code
dump(isNumeric(-2360));
dump(isNumeric(-2360.0));
dump(isNumeric("-2360.0"));
dump(isNumeric(numberFormat(-236, "9,999.9")));
Now strangely enough, it appears that ACF & Lucee both have the same behavior. You can see this behavior on TryCF: https://www.trycf.com/gist/6928301c037034c917e8771700dad03c/lucee5?theme=monokai Am I misunderstanding something or should
isNumeric(numberFormat(-2360, "9,999.9"))
indeed be returning
true
?
r
I believe the comma is causing the result to be false, which is correct.
d
That is indeed the root cause of why it returns
false
. I suppose that makes sense.
t
if your locale uses commas you can use https://cfdocs.org/lsisnumeric
d
@thisOldDave Thanks!
z
try it with german numbers 1.000,00 lol
e
As above, remove the comma. Think of this as a c++ INT not a python object.