std.range.byLine

"Nordlöw" via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 10 16:01:42 PDT 2014


On Wednesday, 10 September 2014 at 22:45:08 UTC, Nordlöw wrote:
> auto byLine(Range)(Range input) if (isForwardRange!Range)
> {
>     import std.algorithm: splitter;
>     import std.ascii: newline;
>     static if (newline.length == 1)
>     {
>         return input.splitter(newline.front);
>     }
>     else
>     {
>         return input.splitter(newline);
>     }
> }

IMHO, this should be added to std.string and restricted to 
isSomeString. Should I do a PR?


More information about the Digitalmars-d-learn mailing list