Skip to content

Commit

Permalink
Explicitly mention trimming in String.split/1 doc (#13802)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabiwara authored Sep 1, 2024
1 parent 00f2662 commit 1ccb7a1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/elixir/lib/string.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1ccb7a1

Please sign in to comment.