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

instance method String#codepoints

each_codepoint {|codepoint| block } -> self
codepoints {|codepoint| block } -> self
each_codepoint -> Enumerator
codepoints -> Enumerator

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

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