/ Published in: Ruby

Quick conversion from a string of binary into ascii, and back again.\r\nUse B* for MSB and b* for LSB first.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
puts "011010000110010101101100011011000110111100100000".scan(/.{1,8}/).collect{|x| x.to_i(2).chr}.to_s.inspect puts "hello there".split(//).collect{|x| x.unpack("B*")}.to_s.inspect
Comments
