From: Gavin Kistner Date: 2006-10-19T08:41:58+09:00 Subject: Re: Bitwise operations From: Rob Lee > I can't understand how to access the first byte from > a string (a series of 8 bit bytes I believe). There don't seem to be any > bit-shift operators in Ruby for a string - could anybody > advise how I go about this ? Strings in Ruby are, as you say, series of 8-bit bytes. The String#[] operator when called with a single integer index returns the numeric value of the requested byte: irb(main):001:0> s = "\xf7\x23" => "\367#" irb(main):002:0> s[0] => 247 irb(main):003:0> s[0].to_s(16) => "f7"