From: Harry Kakueki Date: 2007-05-06T23:20:49+09:00 Subject: Re: Simple Q: bit string -> integer On 5/6/07, Todd Benson wrote: > Is there a simple way to induce a bit string into an > integer; for example, "10010000" into 144? And also, > to show a Fixnum in its different representations > (hex, num, binary)? > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > Try this str = "10010000" p str.to_i(2) puts p 255.to_s(16) p 255.to_s(2) Harry -- http://www.kakueki.com/ruby/list.html A Look into Japanese Ruby List in English