Ruby 1.9.3 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Stringクラス > bytes

instance method String#bytes

each_byte {|byte| ... } -> self[permalink][rdoc]
bytes {|byte| ... } -> self
each_byte -> Enumerator
bytes -> Enumerator

文字列の各バイトに対して繰り返します。

例:

"str".each_byte do |byte|
  p byte
end
    # => 115
    # => 116
    # => 114