このマニュアルは既にメンテナンスが終了したバージョンの Ruby を対象としています。 最新版のマニュアルへ

Ruby 1.9.3 リファレンスマニュアル

instance method String#each_codepoint

each_codepoint {|codepoint| block } -> self[permalink][rdoc]
each_codepoint -> Enumerator

文字列の各コードポイントに対して繰り返します。

#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]

[SEE_ALSO] String#codepoints