Created
April 28, 2019 02:41
-
-
Save mattsan/5c593288b9f9c126ea41fdd4aae4c101 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sample of CSV package | |
# | |
# see https://hex.pm/packages/csv | |
"a,b\n1,2\n3,4\n" | |
|> IO.inspect() | |
|> String.split() # split a string into lines | |
|> IO.inspect() | |
|> CSV.decode!(headers: [:a, :b]) # decode with headers | |
|> Enum.to_list() # realize a list of maps | |
|> IO.inspect() | |
|> CSV.encode(headers: true) # encode with headers | |
|> Enum.to_list() # realise a list of strings | |
|> IO.inspect() | |
|> IO.puts() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment