Ruby: How can I process a CSV file with “bad commas”?

后端 未结 4 1330
野趣味
野趣味 2021-01-23 16:10

I need to process a CSV file from FedEx.com containing shipping history. Unfortunately FedEx doesn\'t seem to actually test its CSV files as it doesn\'t quote strings that have

4条回答
  •  面向向阳花
    2021-01-23 16:44

    Well, here's an idea: You could replace each instance of comma-followed-by-a-space with a unique character, then parse the CSV as usual, then go through the resulting rows and reverse the replace.

提交回复
热议问题