From: Brian Candler on
Zsdfhdfgasdf Gsfgsdgsdgsd wrote:
> Also, if a string DOES contain bytes, it won't show.
>
> ----------
> a = "\x07"
> puts "Returns: '#{a}'"

a = "\x07\x00\x41\x42\x43\xff"
puts "Returns: #{a.inspect}"
puts "Returns: #{a.unpack("H*").first}"

> How would I manipulate it?

Just as a String:

a.length
a[1,3] # slice from pos 1 for 3 bytes
.. etc

But if you know precisely the format you're expecting, then
String#unpack will allow you to break it up into integers and
substrings.
--
Posted via http://www.ruby-forum.com/.

From: Zsdfhdfgasdf Gsfgsdgsdgsd on
Amazing! Then again, thank you. I think I finally reached the point
where I can make this server without opening another Google query!
--
Posted via http://www.ruby-forum.com/.