るりまサーチ (Ruby 3.1)

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.134秒)
トップページ > 種類:インスタンスメソッド[x] > クエリ:u[x] > クエリ:|[x] > バージョン:3.1[x] > クエリ:each_codepoint[x]

別のキーワード

  1. _builtin |
  2. ipaddr |
  3. set |
  4. integer |
  5. trueclass |

ライブラリ

クラス

検索結果

IO#each_codepoint -> Enumerator (54703.0)

IO の各コードポイントに対して繰り返しブロックを呼びだします。

IO の各コードポイントに対して繰り返しブロックを呼びだします。

ブロックの引数にはコードポイントを表す整数が渡されます。

ブロックを省略した場合には、Enumerator を返します。

//emlist[例][ruby]{
IO.write("testfile", "abcdeあ")
File.open("testfile") do |f|
f.each_codepoint { |i| p i }
end
# => 97
# 98
# 99
# 100
# 101
# 12354
//}

ARGF.class#each_codepoint -> Enumerator (54688.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

self の各コードポイントに対して繰り返しブロックを呼びだします。

ブロックの引数にはコードポイントを表す整数が渡されます。

ブロックを省略した場合には、Enumerator を返します。

例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_codepoint # => #<Enumerator: ARGF:each_codepoint>
...

String#each_codepoint -> Enumerator (54685.0)

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

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

UTF-8/UTF-16(BE|LE)/UTF-32(BE|LE) 以外のエンコーディングに対しては
各文字のバイナリ表現由来の値になります。

//emlist[例][ruby]{
#coding:UTF-8
"hello わーるど".each_codepoint.to_a
# => [104, 101, 108, 108, 111, 32, 12431, 12540, 12427, 12393]
"hello わーるど".encode('euc-jp').each_codepoint.to_a
# => [104, 101, 108, 1...

StringIO#each_codepoint -> Enumerator (54631.0)

自身の各コードポイントに対して繰り返します。

自身の各コードポイントに対して繰り返します。

@see IO#each_codepoint