24件ヒット
[1-24件を表示]
(0.026秒)
検索結果
-
CSV
. parse _ line(line , options = Hash . new) -> Array (18220.0) -
このメソッドは一行の CSV 文字列を配列に変換するためのショートカットです。
...行目以外は無視します。
@param options CSV.new のオプションと同じオプションを指定できます。
//emlist[例][ruby]{
require 'csv'
p CSV.parse_line("1,taro,tanaka,20")
# => ["1", "taro", "tanaka", "20"]
p CSV.parse_line("1|taro|tanaka|20", col_sep: '|')
# => ["1", "ta......ro", "tanaka", "20"]
# 列をダブルクオートで囲むとその中にカンマや改行を含める事もできる。
# 他の仕様も含め詳しくはRFC4180を参照。
p CSV.parse_line("1,\"ta,ro\",\"tana\nka\", 20")
# => ["1", "ta,ro", "tana\nka", " 20"]
//}... -
CSV
. new(data , options = Hash . new) -> CSV (119.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...ンスタンスを指定した場合、CSV#string を使用して
後からデータを取り出すことが出来ます。
@param options CSV をパースするためのオプションをハッシュで指定します。
パフォーマンス上の理由でインスタ......If none of those sequences is
found, +data+ is ARGF, Object::STDIN, Object::STDOUT, or
Object::STDERR, or the stream is only available for output, the default
$INPUT_RECORD_SEPARATOR ($/) is used. Obviously,
discovery takes a little time. Set manually if speed is important. Also
note......that IO objects should be opened in binary mode on Windows if this
feature will be used as the line-ending translation can cause
problems with resetting the document position to where it was before the
read ahead. This String will be transcoded into the data's Encoding before parsing.
:...