3件ヒット
[1-3件を表示]
(0.260秒)
検索結果
-
CSV
# col _ sep -> String (72661.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"... -
CSV
# inspect -> String (18322.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:\"\\\"\">"
//} -
String
# parse _ csv(**options) -> [String] (18322.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 # => ["Matz", "Ruby"]
p "Matz|Ruby\r\n".parse_csv(col_sep: '|', row_sep: "\r\n") # => ...