From: Aleksey V Zapparov Date: 2012-07-12T19:45:38+09:00 Subject: Re: how to check string is numeric or not --Sig_/A_cbsy7_P7BXEQCg+CxLJ1s Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 12 Jul 2012 19:16:08 +0900 Lucky Nl wrote: > Hi friends > I want to check the value is numeric or not > For example > when i am checking numeric or not am expecting as below results > "34" =3D> true > 34 =3D> true > "34sdfds" =3D> it should return false > 34.90 =3D> false >=20 > am using ruby 1.8.7. can anyone suggest isthere is anymethod exist to > check these def is_numeric(o) true if Integer(o) rescue false end --=20 Sincerely yours, Aleksey V. Zapparov A.K.A. ixti FSF Member #7118 Mobile Phone: +34 677 990 688 Homepage: http://www.ixti.net JID: zapparov@jabber.ru *Origin: Happy Hacking! --Sig_/A_cbsy7_P7BXEQCg+CxLJ1s Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJP/qrMAAoJEGRO9nGLm9Y8n8MH/0LP8Ct55nqLArYSsHyeVsBI 21E3cUbhBdqMti59VNcYaOLliJBdBQL2Mo7zWsn6y1fvqCr6kzOSDTC53J2r9YxK Z9n0ST8Yl0CqeurB8HBeEKw5njP2NR4r49xuBdtqRj4uNbRqUq6QODyCyiiwZpL3 l/FA177TbZKJC18s5jcne/xgpo9yPRIKS7f8WW1Cjnjh5V3ZI7qrm1m/N6U3cDh8 fp854XzhdWRqmnRDbbZ2+MDZWd4HxXGlq0MKXXMiCLYO/NvVcOXpCTTJYsgRyspx +AimXeWDha/VDMJVDv64Zk1ByM8rHIuDW2d2ppKGxhqWR/auo4vQbpQUMC3CCuI= =afND -----END PGP SIGNATURE----- --Sig_/A_cbsy7_P7BXEQCg+CxLJ1s--