ben-strasser / fast-cpp-csv-parser

fast-cpp-csv-parser
BSD 3-Clause "New" or "Revised" License
2.15k stars 440 forks source link

How to parse strings with commas in them #30

Closed benstadin closed 8 years ago

benstadin commented 8 years ago

I get a "too many columns" error when trying to parse a string with comma in it. However, I can't escape this string in the CSV because it is a valid WKT string (and read by other tools reading this CSV file).

My CSV looks like this: id, wkt 0,"POLYGON ((1 0,-1 0,1 0))"

ChrisWilliams-missingsemicolons commented 8 years ago

You want to use the following to construct your CSVReader

io::CSVReader<2, io::trim_chars<' ', '\t'>, io::double_quote_escape<',', '"'>> inFile("testfile.csv");

(Tested on XUbuntu)