BrianHicks/elm-csv/3.0.0

NOTE: the latest version is 4.0.1

Csv.Parser

CSV (and TSV) parsing.

{ fieldSeparator : Char }
-> String
-> Result Problem (List (List String))

Turn a CSV string into a list of rows. Prefer using Csv.Decode.decodeCsv or Csv.Decode.decodeCustom unless you need something unusally custom (and please open an issue if so!)

type Problem
= SourceEndedWithoutClosingQuote Int
| AdditionalCharactersAfterClosingQuote Int

Something went wrong during parsing! What was it?

  • SourceEndedWithoutClosingQuote: we started parsing a quoted field, but the file ended before we saw a closing quote. If you meant to have a literal quote in your data, quote the whole field and then escape the literal quote by replacing it with "". For example, ": double prime would be encoded as """: double prime".
  • AdditionalCharactersAfterClosingQuote: we found the closing pair of a quoted field, but there was data after it but before a separator or the end of the file. Follow the quote-escaping advice above to get around this.