diff --git a/lib/elixir/lib/string.ex b/lib/elixir/lib/string.ex index 12a96912142..7f76063bd5a 100644 --- a/lib/elixir/lib/string.ex +++ b/lib/elixir/lib/string.ex @@ -357,9 +357,10 @@ defmodule String do @doc ~S""" Divides a string into substrings at each Unicode whitespace - occurrence with leading and trailing whitespace ignored. Groups - of whitespace are treated as a single occurrence. Divisions do - not occur on non-breaking whitespace. + occurrence with leading and trailing whitespace ignored. + + Groups of whitespace are treated as a single occurrence. + Divisions do not occur on non-breaking whitespace. ## Examples @@ -375,6 +376,11 @@ defmodule String do iex> String.split("no\u00a0break") ["no\u00a0break"] + Removes empty strings, like when using `trim: true` in `String.split/3`. + + iex> String.split(" ") + [] + """ @spec split(t) :: [t] defdelegate split(binary), to: String.Break