From: Konrad Meyer Date: 2007-10-05T23:01:56+09:00 Subject: Re: finding obscure documentation --nextPart20203525.nMOOVUyGsE Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Quoth Lloyd Linklater: > I have learned that you can turn a number to octal (or whatever) this > way: >=20 > p 123.to_s(8).to_i > =3D> 173 >=20 > I seem to recall that there is something which will read *in* a number > in an arbitrary numeric base, though I forget just how to do that. >=20 > My question is, where is this and things like it documented? I have > searched several books to no avail. "0x123".to_i(16) # =3D> 291 Your method of "turn[ing] a number to octal" turns it to octal in a string,= =20 then converts it back to an integer. You really want to leave off the .to_i= =20 bit. HTH, =2D-=20 Konrad Meyer http://konrad.sobertillnoon.com/ --nextPart20203525.nMOOVUyGsE Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBHBkPPCHB0oCiR2cwRArgNAJ4iXDMMrK7lH/HbPclHrHLyM4ZCUwCeN+Pz l0Y0H1p/rvlT477dVFA2luI= =ZsPG -----END PGP SIGNATURE----- --nextPart20203525.nMOOVUyGsE--