π A cool use of Elixir's `String.split/2` I didn't know about
Notes
A cool use of String.split/2
I didnβt know about until a colleague pointed it
out the other day.
Love having these tricks up my sleeve for when I need them.
This one is helpful when you have a string with two delimiters, and you want to get whatβs inside of them.
It turns out, String.split/2
takes a list of things to split! π
iex> a = "{hello}"
iex> String.split(a, ["{", "}"]) |> Enum.at(1)
# => "hello"