CSV Parsing
The first part of the program we’ll work on is handling CSV conversion. No specific order is better than another in this case, and starting with CSV instead of filtering or email rendering is entirely arbitrary. In this section, we’ll explore how to come up with the right type of properties for encoding and decoding CSV, and how to get decent generators for that task. We’ll also see how regular example-based unit tests can be used to strengthen our properties, and see how each fares compared to the other.
CSV is a loose format that nobody really implements the same way. It’s really a big mess, even though RFC 4180[28] tries to provide a simple specification:
-
Each record is on a separate line, separated by CRLF (a \r followed by a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access