From: Brian Candler Date: 2012-10-20T06:17:14+09:00 Subject: Re: Converting binary string to integer for a Ruby newbie John Ringwalt wrote in post #1080074: > I want to convert a string of binary code ("011001") to the integer > value WITHOUT using to_i or any other preset method. How can I do this? > > Thanks for reading. One of many solutions: res = 0 str.each_char do |c| res *= 2 res +=1 if c == "1" end -- Posted via http://www.ruby-forum.com/.