From: "Bartosz DziewoƄski" Date: 2012-10-17T04:50:45+09:00 Subject: Re: Converting binary string to integer for a Ruby newbie 2012/10/16 Hans Mackowiak : > "011001".each_char.reverse_each.with_index.inject(0) {|v,(dig,i)| v + > (dig == '1' ? 2**i : 0 )} #=> 25 Well that's totally helpful for someone trying to learn a new language, or possibly programming. And totally readable for seasoned devs. /sarcasm +1 for Jan's answer. -- Matma Rex