for more information visit the package's GitHub page
Package contains the following modules:
Parse CSV files according to RFC 4180 (including values with quoted commas).
elm install samuelstevens/elm-csv
Suppose you have a file star-wars-quotes.csv
with the following content:
quote,character
"Why, hello there",Obi-Wan Kenobi
"General Kenobi.",General Grievous
Once this is read into an Elm string, you could parse it like this:
import Csv
let
content =
"quote,character\n\"Why, hello there\",Obi-Wan Kenobi\n\"General Kenobi.\",General Grievous"
in
Csv.parseRows content --> Ok [[ "quote", "character"],["Why, hello there", "Obi-Wan Kenobi"],["General Kenobi.", "General Grievous"]]
Calling Csv.parseCsv
will produce a list of lists of strings, properly escaped from their CSV representation.