12件ヒット
[1-12件を表示]
(0.086秒)
ライブラリ
- ビルトイン (12)
検索結果
-
String
# count(*chars) -> Integer (20.0) -
chars で指定された文字が文字列 self にいくつあるか数えます。
...回数を数える文字のパターン
//emlist[例][ruby]{
p 'abcdefg'.count('c') # => 1
p '123456789'.count('2378') # => 4
p '123456789'.count('2-8', '^4-6') # => 4
# ファイルの行数を数える
n_lines = File.read("foo").count("\n")
# ファイルの末尾に改...