34件ヒット
[1-34件を表示]
(0.014秒)
種類
- インスタンスメソッド (24)
- 文書 (10)
キーワード
-
NEWS for Ruby 2
. 3 . 0 (10) - readlines (12)
検索結果
-
String
# count(*chars) -> Integer (18149.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")
# ファイルの末尾に改行コードがな......い場合にも対処する
buf = File.read("foo")
n_lines = buf.count("\n")
n_lines += 1 if /[^\n]\z/ =~ buf
# if /\n\z/ !~ buf だと空ファイルを 1 行として数えてしまうのでダメ
//}... -
CSV
# readlines -> [Array] | CSV :: Table (3106.0) -
残りの行を読み込んで配列の配列を返します。 self の生成時に headers オプションに偽でない値が指定されていた場合は CSV::Table オブジェクトを返します。
..._1", "row1_2"], ["row2_1", "row2_2"]]
__END__
header1,header2
row1_1,row1_2
row2_1,row2_2
//}
//emlist[例 headers: true][ruby]{
require "csv"
csv = CSV.new(DATA.read, headers: true)
csv.read
# => #<CSV::Table mode:col_or_row row_count:3>
__END__
header1,header2
row1_1,row1_2
row2_1,row2_2
//}... -
NEWS for Ruby 2
. 3 . 0 (18.0) -
NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...151
* Proc
* Proc#call ( Proc#[] , Proc#===, Proc#yield) は最適化されました。
Backtrace doesn't show each method (show block lines directly).
TracePoint also ignores these calls.
11569
* Queue (Thread::Queue)
* 終了を通知するために Queue#close(Thre......t::FTP#mlsd を追加。
* nkf
* nkf 2.1.4 をマージしました。
* ObjectSpace (objspace)
* ObjectSpace.#count_symbols を追加。
* ObjectSpace.#count_imemo_objects を追加。
* ObjectSpace.#internal_class_of を追加。
* ObjectSpace.#internal_super_of を追加...