I set sentence to a string. When I pipe it into String.split(’’) it doesn’t work. Variations of String.split() do not work either. What fundamental piece of knowledge am I missing here?
sentence = "one fish two fish red fish blue fish"
sentence |> String.split('')
** (ArgumentError) argument error
(stdlib) :binary.split("one fish two fish red fish blue fish", [], [:global])
(elixir) lib/string.ex:424: String.split/3
When I try a RegEx, it does work. For example:
sentence |> String.split(~r/[\s_]/)
returns what I expected from the first code example.
Why is that?