IsNumeric vs IsValid




The problem is that they aren’t exactly equivalent.  Try the following:

	#IsValid('numeric', '5a')#

and you’ll see NO YES.

So why does IsValid() think 5a is a number? Well after a bit of experimentation (via establishing that although 5a is a number, 5b is not) we realized that it was interpreting 5a as a time (5am), 23p validates as a number while 24p does not. You can even use a full date like 2010-01-02 12:12:32 and it will validate as a number using IsValid()

Interestingly, the documentation for IsNumeric() doesn’t actually say that it determines whether the value is a number, but but whether it can be converted to a number, a subtle but important distinction. Oddly though, that seems to be a more accurate description of what IsValid() is doing – 5a can be converted to a number (0.208333333332) using JavaCast(), 24f cannot.

The moral of the story is that if you want a strict check on whether something is a number rather than something that can be converted to a number, use IsNumeric(), or use Railo instead ;)