Normally I just use TStringList.CommaText, but this wont work when a given field has multiple lines. Basically I need a csv processor that conforms to rfc4180. I’d rather not have to implement the RFC myself.
Normally I just use TStringList.CommaText, but this wont work when a given field has
Share
Do you really need full RFC support? I can’t count the number of times I’ve written a “csv parser” in perl or something similar. Split on comma’s and be done. The only problem comes when you need to respect quotes. If you do, write a “quotesplit” routine that looks for quotes and ensures they’re balanced. Unless this csv processor is the meat and potatoes of some application, I’m not sure it’ll really be a problem.
On the other hand, I really don’t think fully implementing the rfc is that complex. That’s a relatively short rfc in comparison to things like… HTTP, SMTP, IMAP, …
In perl, a decent
quotesplit()I wrote is: