【问题】
I have a csv file that looks like this:
"first", "abc", "def", "last"
"111", "abc", "p"roblem", "last"
"aaa", "abc", "456", "last"
As you can see the second row has an extra double quote in text.
I am using below constructor:
reader = new CSVReader(new FileReader("temp.csv"), ',', '"', '|', 1);
Program fails because of that extra " in 2nd row.
How can I workaround this problem. I can't change the csv.
Thanks.
【回答】
如果无法用opencsv解决,可以试试SPL:
A | |
1 | file("D:\\data.csv").import@tcq()= |
2 | =A1.run(replace(def,"\"",""):def) |
3 | =A2 |