From: Mike Moore Date: 2007-07-14T05:55:59+09:00 Subject: Re: Base 26 ------=_Part_24376_25075082.1184360151672 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 7/13/07, Stefan Rusterholz wrote: > > Stefan Rusterholz wrote: > > Mike Moore wrote: > >> Hey friends! What is the best way to convert a Numeric to a string > >> encoded > >> with base 26? I want the string to contain just alpha characters, not > >> alphanumeric characters. For now I'm using num.to_s(26).tr('0-9a-p', > >> 'a-z') > >> and I'm wondering if there is a more concise way. > >> > > > > You're looking too far away. > > int.to_s(26) > > > > Regards > > Stefan > > OK, I should read before answering :) > Why are you using a-z instead of 0-9a-p? Because it is one extra step to switch to the number keys on the iPhone keyboard. :) Anyway, if you need that instead of what to_s(26) already does, then I > don't know a shorter way. Yeah, I was looking for an offset value, something like Numeric#to_s(base=10, offset=0) Regards > Stefan > > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_24376_25075082.1184360151672--