Skip to content

Commit

Permalink
Merge pull request #1854 from eco/splitter-notes
Browse files Browse the repository at this point in the history
Add notes to Splitter docs
  • Loading branch information
monarchdodra committed Jan 15, 2014
2 parents 2227fb6 + 6e75a54 commit aa67b76
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion std/algorithm.d
Original file line number Diff line number Diff line change
Expand Up @@ -2293,11 +2293,19 @@ any narrow string type or sliceable range type, but is most popular
with string types.
Two adjacent separators are considered to surround an empty element in
the split range.
the split range. Use $(D filter!(a => !a.empty)) on the result to compress
empty elements.
If the empty range is given, the result is a range with one empty
element. If a range with one separator is given, the result is a range
with two empty elements.
If splitting a string on whitespace and token compression is desired,
consider using $(D splitter) without specifying a separator (see overload
below).
See also $(XREF regex, splitter) for a version that splits using a regular
expression defined separator.
*/
auto splitter(Range, Separator)(Range r, Separator s)
if (is(typeof(ElementType!Range.init == Separator.init))
Expand Down Expand Up @@ -2542,6 +2550,13 @@ unittest
Splits a range using another range as a separator. This can be used
with any narrow string type or sliceable range type, but is most popular
with string types.
Two adjacent separators are considered to surround an empty element in
the split range. Use $(D filter!(a => !a.empty)) on the result to compress
empty elements.
See also $(XREF regex, splitter) for a version that splits using a regular
expression defined separator.
*/
auto splitter(Range, Separator)(Range r, Separator s)
if (is(typeof(Range.init.front == Separator.init.front) : bool)
Expand Down

0 comments on commit aa67b76

Please sign in to comment.