byLine

Returns a range that reads from the pipeline one line at a time.

Allowed input element types are built-in character and integer types. The stream is interpreted as UTF-8, UTF-16 or UTF-32 according to the input element size. Range elements are arrays of respective built-in character types.

Each front is valid only until popFront is called. If retention is needed, a copy must be made using e.g. idup or to!string.

  1. auto byLine(S schema, Terminator terminator, Flag!"keepTerminator" keep_terminator)
  2. auto byLine(S schema, Terminator terminator, Flag!"keepTerminator" keep_terminator)
    byLine
    (
    S
    Terminator
    )
    (,
    Terminator terminator
    ,
    Flag!"keepTerminator" keep_terminator = No.keepTerminator
    )
    if (
    isSchema!S &&
    isInputRange!Terminator
    )

Examples

import std.uni : toUpper;
assert("first\nsecond\nthird\n".byLine.equal(["first", "second", "third"]));
assert("zażółć\r\ngęślą\r\njaźń".map!toUpper.byLine("\r\n").equal(["ZAŻÓŁĆ"d, "GĘŚLĄ"d, "JAŹŃ"d]));

Meta