in reply to Re: How to check Inputs if Numeric
in thread How to check Inputs if Numeric

Yours fails for negative numbers, and for strings with more than one decimal place


davis
It's not easy to juggle a pregnant wife and a troubled child, but somehow I managed to fit in eight hours of TV a day.

Replies are listed 'Best First'.
Re^3: How to check Inputs if Numeric
by pelagic (Priest) on Apr 01, 2004 at 08:18 UTC
    > Yours fails for negative numbers
    I know it's primitive. But I coded it in about 5 seconds and for some application it might be good enough.

    > , and for strings with more than one decimal place
    Not True. It declares anything containing something else than numbers and decimal ponit(s) as non-numeric.

    For a real application I'd use something like Abigail's Regexp::Common

    pelagic
    -------------------------------------
    I can resist anything but temptation.