https://issues.dlang.org/show_bug.cgi?id=20184

--- Comment #2 from [email protected] ---
(In reply to Jon Degenhardt from comment #1)
> This can be achieved using 'splitter' and 'take' or another range iteration
> algorithm that limits the number of candidates selected.
> 
> e.g.
> 
> assert("a|bc|def".splitter('|').take(4).equal([ "a", "bc", "def" ]));
> assert("a|bc|def".splitter('|').take(3).equal([ "a", "bc", "def" ]));
> assert("a|bc|def".splitter('|').take(2).equal([ "a", "bc" ]));

It seems you have a profound misunderstand of what split limiting is. Here is a
result with Python:

    >>> 'one two three'.split(maxsplit = 1)
    ['one', 'two three']

as you can see, it doesnt discard any part of the original input, instead it
stops splitting after the specified amount, and puts the rest of the string as
the final element.

--

Reply via email to