From: Rob Biedenharn Date: 2007-10-05T23:12:07+09:00 Subject: Re: finding obscure documentation On Oct 5, 2007, at 9:29 AM, Lloyd Linklater wrote: > 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. irb(main):001:0> "173".to_i(8) => 123 ri String#to_i and you don't need the .to_i on your example. If the base it more than 10, it won't work anyway. irb(main):002:0> 26.to_s(16).to_i => 1 irb(main):003:0> 26.to_s(16) => "1a" -Rob Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com