るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

キーワード

検索結果

<< < 1 2 3 >>

CSV#col_sep -> String (216.0)

カラム区切り文字列として使用する文字列を返します。

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

users =<<-EOS
id|first name|last name|age
1|taro|tanaka|20
2|jiro|suzuki|18
3|ami|sato|19
4|yumi|adachi|21
EOS

csv
= CSV.new(users, headers: true, col_sep: "|")
csv
.col_sep # => "|"
csv
.first.to_a # => [["id", "1"], ["first name", "taro"], ["last name", "tanaka"]...
..., ["age", "20"]]

csv
= CSV.new(users, headers: true)
csv
.col_sep # => ","
csv
.first.to_a # => [["id|first name|last name|age", "1|taro|tanaka|20"]]
//}

@see CSV.new...

CSV#row_sep -> String (216.0)

行区切り文字列として使用する文字列を返します。

...行区切り文字列として使用する文字列を返します。

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

csv
= CSV.new("header1,header2|row1_1,row1_2", row_sep: "|")
csv
.row_sep # => "|"
csv
.read # => [["header1", "header2"], ["row1_1", "row1_2"]]
//}

@see CSV.new...

CSV::FieldInfo#header -> String | nil (216.0)

利用可能な場合はヘッダを表す文字列を返します。

...list[例][ruby]{
require 'csv'

csv
= CSV.new("date1,date2\n2018-07-09,2018-07-10", headers: true)
csv
.convert do |field,field_info|
p field_info.header
Date.parse(field)
end
p csv.first

# => "date1"
# => "date2"
# => #<CSV::Row "date1":#<Date: 2018-07-09 ((2458309j,0s,0n),+0s,2299161j)> "date2...
...":#<Date: 2018-07-10 ((2458310j,0s,0n),+0s,2299161j)>>
//}...
<< < 1 2 3 >>