3 ms·
Generally it is best to use an actual CSV parser if you can. There are enough corner cases in it that a custom parser will almost never get everything. Plus,
by jandrese 12y ago
Generally it is best to use an actual CSV parser if you can. There are enough corner cases in it that a custom parser will almost never get everything. Plus, the libraries that implement CSV parsing are generally easy to use and self contained.
The article waxed on about how easy it is to import a CSV into a spreadsheet, but I've found that Excel for instance has a pretty lousy CSV parser that is easy to confuse even if your file is properly escaped. Sometimes it is easier to convert the separator character to something that does not appear in your data (| or <tab> often works) instead of trying to escape and quote exceptions.