😎 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"

Want the latest Elixir Streams in your inbox?

    No spam. Unsubscribe any time.