るりまサーチ

最速Rubyリファレンスマニュアル検索!
44件ヒット [1-44件を表示] (0.048秒)
トップページ > クエリ:new[x] > クエリ:quote_char[x]

別のキーワード

  1. csv quote_char
  2. readline basic_quote_characters
  3. readline basic_quote_characters=
  4. readline filename_quote_characters
  5. readline completer_quote_characters

ライブラリ

クラス

キーワード

検索結果

CSV.new(data, options = Hash.new) -> CSV (18226.0)

このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。

...ing the document position to where it was before the
read ahead. This String will be transcoded into the data's Encoding before parsing.
: :quote_char
フィールドをクオートする文字を指定します。長さ 1 の文字列でなければなりません。
正しいダブルク...
...を指定すると CSV.parse_line を
使用してパースした結果をヘッダとして扱います。このとき、:col_sep, :row_sep, :quote_char
はこのインスタンスと同じものを使用します。この設定は CSV#shift
の返り値を配列のかわりに CSV::Row の...
...e
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS

File.write("test.csv", users)

File.open("test.csv", "r") do |f|
csv = CSV.new(f, headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "last name":"tanaka" "age":"20">
end
//}

//emlist[...

CSV#quote_char -> String (18125.0)

フィールドをクオートするのに使用する文字列を返します。

...フィールドをクオートするのに使用する文字列を返します。

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

csv = CSV.new("header1,header2\nrow1_1,row1_2", quote_char: "'")
csv.quote_char # => "'"
//}

@see CSV.new...

CSV (12.0)

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

...tderr) { |csv_err| csv_err << %w{my data here} } # to $stderr
//}

=== CSV と文字エンコーディング (M17n or Multilingualization)

This new CSV parser is m17n savvy. The parser works in the Encoding of the IO
or String object being read from or written to. Your data is never transcode...
...e transcoding must take place, of course, to accomplish this multiencoding
support. For example, <tt>:col_sep</tt>, <tt>:row_sep</tt>, and
<tt>:quote_char</tt> must be transcoded to match your data. Hopefully this
makes the entire process feel transparent, since CSV's defaults should just
magicall...

CSV#inspect -> String (12.0)

ASCII 互換文字列で自身の情報を表したものを返します。

...ASCII 互換文字列で自身の情報を表したものを返します。

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

csv = CSV.new("header1,header2\nrow1_1,row1_2")
csv.inspect # => "<#CSV io_type:StringIO encoding:UTF-8 lineno:0 col_sep:\",\" row_sep:\"\\n\" quote_char:\"\\\"\">"
//}...