From: 7stud -- Date: 2008-02-12T09:50:25+09:00 Subject: Re: Ruby one liner killed my script John Maclean wrote: > I'm wondering > how I can convert a user's input into a fixnum? > > def put_bin_string > # this is the line in which I originally tried to convert > # the user's binary digit to denary: > >puts "your bin #{@ustring.to_i} = > 0b#{@ustring.to_i}" end > end > Does this help: input = "10000001" puts input.to_i(base=2) --output:-- 129 -- Posted via http://www.ruby-forum.com/.