るりまサーチ

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

別のキーワード

  1. string []=
  2. string []
  3. string slice!
  4. string slice
  5. string gsub

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 >>

CSV (18.0)

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

..."another", "row"]
# ...
end

# 文字列へ書き込み
csv_string = CSV.generate do |csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end
//}

=== 一行変換

//emlist[][ruby]{
require 'csv'

csv_string = ["CSV", "data"].to_csv # => "CSV,data"
csv_array = "CSV,S...
...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...

Enumerator#with_object(obj) -> Enumerator (12.0)

繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。

...erator を返します。

//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times do |x|
y << x
end
end

to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{string}: #{x}"
end
# => foo:0
# =>...

Enumerator#with_object(obj) {|(*args), memo_obj| ... } -> object (12.0)

繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。

...erator を返します。

//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times do |x|
y << x
end
end

to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{string}: #{x}"
end
# => foo:0
# =>...
<< < 1 2 >>