Skip to content

Commit 6f7c9ca

Browse files
committed
Be explicit about interaction btw :trim and :parts
1 parent dd46ead commit 6f7c9ca

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/elixir/lib/string.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@ defmodule String do
488488
iex> String.split(String.normalize("é", :nfc), "e")
489489
["é"]
490490
491+
When using both the `:trim` and the `:parts` option, note that the
492+
trimming doesn't affect the last part:
493+
494+
iex> String.split(" a b c ", " ", trim: true, parts: 2)
495+
["a", " b c "]
496+
491497
"""
492498
@spec split(t, pattern | Regex.t(), keyword) :: [t]
493499
def split(string, pattern, options \\ [])

0 commit comments

Comments
 (0)