mercredi 19 mars 2014

Empty quote char in FasterCSV topic




I have to generate a file with values separated with semicolon. There are empty values for which "" is unwanted.

For example, this code
FasterCSV.generate({:col_sep => ";"}) { |csv| csv << ["another", "", "row"] }

generates the following output:
another;"";row

As you see, "" is unwanted in output. The wanted output is
another;;row


I tried to accomplish it using :quote_char with the following code:
FasterCSV.generate({:col_sep => ";", :quote_char=>""}) { |csv| csv << ["another", "", "row"] }

Is there a way to omit empty ""?





Aucun commentaire:

Enregistrer un commentaire