From: "Jan E." Date: 2012-10-17T03:35:22+09:00 Subject: Re: Converting binary string to integer for a Ruby newbie Hi, if you don't want to use the built-in methods, you'll have to loop over the characters and sum the values of the digits. The easiest way is to start from right and let an index count from 0 up. This will give you the exponent of each power of 2: num = '011001' value = 0 '011001'.reverse.each_char.with_index do |dig, i| value += 2**i if dig == '1' end puts value So for every digit "1", you add the corresponding value. -- Posted via http://www.ruby-forum.com/.