Scott,
Ok.. this is simple but remember that val( ) actually returns a number if
the first part of the string IS a number, and a zero if it is not:
Val(343,200) returns 343
Val(ABC123) returns 0.00
So if you know you are dealing numbers above zero you can use this as a
quick and easy Boolean function. As in
If(val(23,320,2300.00))
{
..then whatever code you need to strip commas and further manage the
variable.
)
Just a thought :)
Mark Kruger - CFG
CF Webtools
www.cfwebtools.com
www.coldfusionmuse.com
O: 402.932.3318
E: [email protected]
Skype: markakruger
-----Original Message-----
From: Scott Brady [mailto:[email protected]]
Sent: Wednesday, December 04, 2013 8:34 AM
To: cf-talk
Subject: Re: isValid - numeric vs. float
Well, in our case, this started out as a way for us to determine if the
variable we're dealing with is a number that we'd need to strip the commas
from. Due to the nature of our code, we only want to strip out the commas
if it's a number. For us, the bug actually works in our favor, because
that's really the only way to determine if it was a number. (Our other
alternative was to do an lsPareNumber() inside a try/catch block, which may
be the way we have to go if Adobe fixes the bug.
Scott
On Wed, Dec 4, 2013 at 8:27 AM, Jon Clausen
<[email protected]>wrote:
>
> Agreed. I would recommend stripping the commas out before you validate
> the number. They do strange things with calculations. For instance,
> numberFormat() converts 1,000 to 41274, as does JavaCast(int,1,000")
> or JavaCast(float,1,000"). I actually think its kind of incorrect
that
> the default behavior for numberFormat(1000) returns 1,000 as it can mess
up
> your calculations, but its been the default for so long, it would
probably
> break backward compatibility for a bunch of apps.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357272
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm