From: Phillip Gawlowski Date: 2008-05-09T04:54:38+09:00 Subject: Re: to check for numericality -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michael W. Ryder wrote: | Farrel Lifson wrote: |> @val = someValue if ( Integer( someValue) rescue Float( someValue ) |> rescue false) |> | | How would you fix this so it would work for valid numbers such as | "1,234.56"? I realize that the OP uses comma separators, but Excel | would import the above number as "1,234.56" to a .csv file. You just failed i18n. 1.234,56 is a Continental European way to express that, and Excel, for example, is aware of that distinction (so should the OS be). ;) And with that last thought: leverage the locale settings of the Os, somehow? Maybe via OpenOffice or Ruby bindings into this (if such a library is available)? - -- Phillip Gawlowski Twitter: twitter.com/cynicalryan Blog: http://justarubyist.blogspot.com ~ Well, it just seemed wrong to cheat on an ethics test. -- Calvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkgjWm0ACgkQbtAgaoJTgL9lRgCdEWEeURvczOdkFjluzwUxmQiN BhMAoIlqJSJ/21OIb0oLZh5vPyApP/Cz =oO45 -----END PGP SIGNATURE-----