From: Simon Krahnke Date: 2007-10-06T00:35:03+09:00 Subject: Re: finding obscure documentation * Lloyd Linklater (15:29) schrieb: > I have learned that you can turn a number to octal (or whatever) this > way: A number is not octal or decimal or whatever. String representations of number are. > p 123.to_s(8).to_i > => 173 That's useless playing around with the methods. Parsing a octal string representation as decimal is just broken. > 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. You format a number with to_s(base=10) and parse it with to_i(base=10). Thus if you have a string that contains an octal encoded number, str.to_i(8) returns the number. And if you got a strange thing the above misparsed "number", you do num.to_s(10).to_i(8). > My question is, where is this and things like it documented? I have > searched several books to no avail. Just look for to_i, there is no magic involved. mfg, simon .... l