byLine

Split Input by line.

byLine
(
Range
)
(
Range input
)
if (
is(typeof(Range.init[0 .. 0])) &&
is(typeof(Range.init[0]) : char)
)

Examples

import std.algorithm.comparison: equal;
assert(equal("a\nb".byLine!(Newline.native), ["a", "b"].s[]));
assert(equal("a\r\nb".byLine!(Newline.win), ["a", "b"].s[]));
assert(equal("a\rb".byLine!(Newline.mac), ["a", "b"].s[]));
assert(equal("a\nb".byLine!(Newline.unix), ["a", "b"].s[]));
assert(equal("a\nb".byLine!(Newline.any), ["a", "b"].s[]));

See Also

http://forum.dlang.org/thread/fjqpdfzmitcxxzpwlbgb@forum.dlang.org#post-rwxrytxqqurrazifugje:40forum.dlang.org

TODO This should fail with better error message: assert(equal((cast(ubyte[])"a\nb").byLine!(Newline.any), ["a", "b"]));

Meta