On 5/6/07, Todd Benson <toddkennethbenson / yahoo.com> 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