samuelstevens / elm-csv / Csv

Parse CSV files according to RFC 4180.

Parsing

parseRows : String -> Result String (List (List String))

Parse a string reprenting the contents of a CSV file. If the string is invalid CSV, returns Err with the CSV that was already parsed when the error was encountered.

parseRows "hello,world\n- a programmer" --> Ok [ [ "hello", "world" ], ["- a programmer"] ]

Generating

escapeRows : List (List String) -> String

Escape a list of CSV rows and produce a single string (that can be written to a file)

escapeRows [ [ "start" ], [ "\"end\"" ] ] --> "start\n\"\"\"end\"\"\""