On 09/10/2014 02:06 PM, "Nordlöw" wrote:
I'm missing a range variant of byLine that can operate on strings
instead of just File.

This is such a common feature so I believe it should have its place in
std.range.

My suggestion is to define this using

splitter!(std.uni.isNewline)

but I'm missing std.uni.isNewline.

I'm guessing the problem here is that newline separators can be 1 or 2
bytes long. that is it Separator must be of the same time as Range.

Should I add an overload in PR?

Destroy.

There is std.ascii.newline. The following works where newline is '\n' e.g. on my Linux system. :)

import std.ascii;
import std.algorithm;
import std.range;

void main()
{
    assert("foo\nbar\n"
           .splitter(newline)
           .filter!(a => !a.empty)
           .equal([ "foo", "bar" ]));
}

Ali

Reply via email to