J
john_urban
I need to put double quotes around String objects from the array, but
not around other types of objects. :force_quotes puts double quotes
around every field. I don't want that. What is the best way to do
this? For example...
a = [["joe","cool",19,1000], ["mary","jane",20,5000]]
CSV.open("new_file.csv", "w", {:force_quotes=>true}) do |csv| a.each
do |r| csv << r end end
gives us this in the csv file:
joe,cool,19,1000
mary,jane,20,5000
I need this:
"joe","cool",19,1000
"mary","jane",20,5000
not around other types of objects. :force_quotes puts double quotes
around every field. I don't want that. What is the best way to do
this? For example...
a = [["joe","cool",19,1000], ["mary","jane",20,5000]]
CSV.open("new_file.csv", "w", {:force_quotes=>true}) do |csv| a.each
do |r| csv << r end end
gives us this in the csv file:
joe,cool,19,1000
mary,jane,20,5000
I need this:
"joe","cool",19,1000
"mary","jane",20,5000