Closed
Description
split
has the following to say regarding the types that the parameter Pattern
can have:
The pattern can be a
&str
, [char
], or a closure that determines the split.
However, another, undocumented, option is that the pattern can also be [&str]
and then each split uses the next item from the slice. This is an awesome feature that is kinda difficult to figure out.
For reference:
https://news.ycombinator.com/item?id=19080404