Testing for numerics

Dar Scott dsc at swcp.com
Mon Oct 2 16:09:30 EDT 2006


On Oct 2, 2006, at 1:29 PM, Dom wrote:

> Rob Cozens <rcozens at pon.net> wrote:
>
>>> if field "MyTextField" is a number
>>
>> This is fine if signed and decimal input is allowed; but isn't an
>> adequate check for numerics that must be positive or integers only.
>
> if field "MyTextField" is an integer
>
> ;-)

Cool.  I need to browse through the dictionary.  Maybe I need an app  
like one of those word-a-day vocabulary builders.

However, there are interesting things that can sneak through as in  
these integers:

"0x02b1"                   (hex)
"3e0"                      (exponent notation, similar to scientific  
notation)
"10.00"                    (zero fraction)
"1000000000000000000.888"  (big number)

Of course, there may be times when one wants to allow those integers.

Dar






More information about the use-livecode mailing list