--zhXaljGHf11kAtnf Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 06, 2011 at 04:27:53PM +0900, Jesù¸ Gabriel y GaláÏ wrote: > > If you need to check if the full string is a valid number, you can use > Kernel#Integer, which will raise an exception: Wow. Somehow I never found that. All this time, I've been doing this: if foo.to_i.to_s == foo . . . or, if appropriate: if foo.to_i.to_s == foo.chomp Thanks for mentioning the Integer() approach. -- Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --zhXaljGHf11kAtnf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk3EDmAACgkQ9mn/Pj01uKVXFwCgkYbvq7VcBr7bwx2cCNlMysp+ XXgAn0oANg2xnSIUdNYWsAGWZD4WUqkf sx -----END PGP SIGNATURE----- --zhXaljGHf11kAtnf--