4 ms·
CSV is a solved problem - RFC 4180: http://tools.ietf.org/html/rfc4180#section-2 http://tools.ietf.org/html/rfc4180#section-2 As used by Lotus 1-2-3 and undou
by Roboprog 13y ago
CSV is a solved problem - RFC 4180: http://tools.ietf.org/html/rfc4180#section-2 http://tools.ietf.org/html/rfc4180#section-2
As used by Lotus 1-2-3 and undoubtedly others before there was an Excel.
Example record:
42,"Hello, world","""Quotes,"" he said.","new
line",x
Now go write a little state machine to parse it... (hint: track odd/even quotes, for starters)
- rquirk 13y agoCoincidentally I did this just this week. I believe there's no need to track quotes, just if it has an opening quote or not. That RFC really explains it all very well. The only edge case I had was with empty records (foo,,bar) and that was probably due to my implementation.