From: Brian Candler Date: 2010-07-16T01:47:27+09:00 Subject: Re: Sending packets over TCP server 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/.