--nextPart20203525.nMOOVUyGsE Content-Type: text/plain; charset tf-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: > > p 123.to_s(8).to_i > => 173 > > 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. > > My question is, where is this and things like it documented? I have > searched several books to no avail. "0x123".to_i(16) # => 291 Your method of "turn[ing] a number to octal" turns it to octal in a string, then converts it back to an integer. You really want to leave off the .to_i bit. HTH, -- Konrad Meyer <konrad / tylerc.org> 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 PG -----END PGP SIGNATURE----- --nextPart20203525.nMOOVUyGsE--