Skip to content

Instantly share code, notes, and snippets.

@fishcakez
Forked from alco/match.exs
Last active August 29, 2015 14:04
Show Gist options
  • Save fishcakez/abca4a9fc5f3ebfece99 to your computer and use it in GitHub Desktop.
Save fishcakez/abca4a9fc5f3ebfece99 to your computer and use it in GitHub Desktop.
File.read("match.exs") |> (fn({:ok, bin}) -> bin end).() |> String.length
#=> 156
s = """
id;name;value
1;foo;hi
2;bar;bye
"""
s
|> String.strip
|> String.split("\n")
|> Enum.map(&String.split(&1, ";"))
|> Enum.map(fn([_,name,_]) -> name end)
#=> ["name", "foo", "bar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment