Empty quote char in FasterCSV

R

Romiras

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 ""?
 
R

Romiras

Damn. I was pretty close to solution.

I supposed just to use nil instead of empty string...

Now it works for me.

Thank you, Michael.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,039
Messages
2,570,376
Members
47,032
Latest member
OdellBerg4

Latest Threads

Top