3 ms·
The CSV 'format' is hell. I just wrote a blog highlighting some of the issues : http://tburette.github.io/blog/2014/05/25/so-you-want-to-write-your-own-CSV-code
by Monkeyget 12y ago
The CSV 'format' is hell. I just wrote a blog highlighting some of the issues : http://tburette.github.io/blog/2014/05/25/so-you-want-to-write-your-own-CSV-code/ http://tburette.github.io/blog/2014/05/25/so-you-want-to-wri...
- EvanPlaice 12y agoIt's not as complex as you make it sound. The parser should pass along any non-terminal characters without issue. The rest of the edge cases (ex newlines in data) can be handled by using a proper DFM (Deterministic Finite State Machine). None of that String.split('\n').split(',') garbage. If you're processing text as binary without using a string reader that can differentiate between UTF-8 and ASCII then you're doing it wrong. With that said, I agree completely that people should use an established library. Code that has been viewed, used, broken by thousands of users is infinitely better than any home grown variant. Source: With lots of blood sweat and tears I authored one of those 'solid' libraries.