るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.015秒)

別のキーワード

  1. process fork
  2. process abort
  3. process setrlimit
  4. tracer display_process_id
  5. tracer display_process_id?

検索結果

CSV (8.0)

このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。

... CSV ファイルやデータに対する完全なインターフェイスを提供します。

=== 読み込み

//emlist[][ruby]{
require "csv"

csv
_text = <<~CSV_TEXT
Ruby,1995
Rust,2010
CSV
_TEXT

IO.write "sample.csv", csv_text

# ファイルから一行ずつ
CSV
.foreach("sample.csv")...
...010"]

# ファイルから一度に
p CSV.read("sample.csv")
# => [["Ruby", "1995"], ["Rust", "2010"]]

# 文字列から一行ずつ
CSV
.parse(csv_text) do |row|
p row
end
# => ["Ruby", "1995"]
# ["Rust", "2010"]

# 文字列から一度に
p CSV.parse(csv_text)
# => [["Ruby", "1995"], ["Rust...
.... Hopefully this
makes the entire process feel transparent, since CSV's defaults should just
magically work for you data. However, you can set these values manually in
the target Encoding to avoid the translation.

It's also important to note that while all of CSV's core parser is now
Encoding agn...