418件ヒット
[1-100件を表示]
(0.059秒)
別のキーワード
クラス
- Array (11)
- CSV (198)
-
CSV
:: FieldInfo (33) -
CSV
:: Row (33) -
CSV
:: Table (132) - String (11)
キーワード
- [] (33)
-
col
_ sep (11) - convert (33)
- each (33)
- empty? (22)
-
field
_ size _ limit (11) - flock (11)
- header (11)
- index (11)
- inspect (33)
- length (11)
- line (11)
-
parse
_ csv (11) - path (11)
- pid (11)
- pos (11)
- pos= (11)
- push (22)
- puts (11)
- reopen (11)
-
row
_ sep (11) - size (11)
-
skip
_ blanks? (11) - tell (11)
-
to
_ csv (22) -
to
_ s (11) - truncate (11)
検索結果
先頭5件
-
String
# parse _ csv(**options) -> [String] (6139.0) -
CSV.parse_line(self, options) と同様です。
...
CSV.parse_line(self, options) と同様です。
1 行の CSV 文字列を、文字列の配列に変換するためのショートカットです。
@param options CSV.new と同様のオプションを指定します。
//emlist[][ruby]{
require "csv"
p "Matz,Ruby\n".parse_csv......]
p "Matz|Ruby\r\n".parse_csv(col_sep: '|', row_sep: "\r\n") # => ["Matz", "Ruby"]
//}
Ruby 2.6 (CSV 3.0.2) から、次のオプションが使えるようになりました。
//emlist[][ruby]{
require 'csv'
p "1,,3\n".parse_csv # => ["1", nil, "3"]
p "1,,3\n".parse_csv(......nil_value: Float::NAN) # => ["1", NaN, "3"]
//}
@see CSV.new, CSV.parse_line......"]
//}
Ruby 2.7 (CSV 3.1.2) から、次のオプションが使えるようになりました。
//emlist[][ruby]{
require 'csv'
p "Matz, Ruby\n".parse_csv # => ["Matz", " Ruby"]
p "Matz, Ruby\n".parse_csv(strip: true) # => ["Matz", "Ruby"]
//}
@see CSV.new, CSV.parse_line... -
CSV
:: Table # empty? -> bool (6115.0) -
ヘッダーを除いて、データがないときに true を返します。
...ーを除いて、データがないときに true を返します。
Array#empty? に委譲しています。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b\n", headers: true)
table = csv.read
p table.empty? # => true
table << [1, 2]
p table.empty? # => false
//}
@see Array#empty?... -
CSV
:: Table # inspect -> String (6109.0) -
モードとサイズを US-ASCII な文字列で返します。
...モードとサイズを US-ASCII な文字列で返します。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.inspect # => "#<CSV::Table mode:col_or_row row_count:2>"
//}... -
CSV
:: Table # push(*rows) -> self (6109.0) -
複数の行を追加するためのショートカットです。
...ow }
//}
@param rows CSV::Row のインスタンスか配列を指定します。
//emlist[例][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
rows = [
CSV::Row.new(table.headers, [4, 5, 6]),
[7, 8, 9]
]
table.push(*rows)
p table[0..2]
# => [#<CSV::Row "a":......"1" "b":"2" "c":"3">, #<CSV::Row "a":4 "b":5 "c":6>, #<CSV::Row "a":7 "b":8 "c":9>]
//}
@see CSV::Table#<<... -
CSV
# col _ sep -> String (6103.0) -
カラム区切り文字列として使用する文字列を返します。
..."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
# inspect -> String (6103.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:\"\\\"\">"
//}... -
CSV
# path -> String (6103.0) -
IO#path に委譲します。
...IO#path に委譲します。
@see IO#path... -
CSV
# pid -> Integer | nil (6103.0) -
IO#pid に委譲します。
...IO#pid に委譲します。
@see IO#pid... -
CSV
# pos -> Integer (6103.0) -
IO#pos, IO#tell に委譲します。
...IO#pos, IO#tell に委譲します。
@see IO#pos, IO#tell... -
CSV
# pos=(n) (6103.0) -
IO#pos= に委譲します。
...IO#pos= に委譲します。
@see IO#pos=...