On Thursday, 2 February 2017 at 18:58:46 UTC, Daniel Kozak wrote:
Even this one could works:

import std.stdio;

void main(string[] args)
{
    auto range = File("text.txt").byLine();

    foreach (line; range)

    {
        if (line != "")
        {
            writeln(line);
            range.popFront;
            char[] url = range.front().dup;
            range.popFront;
            char[] num = range.front().dup
        }
    }
}

Thanks readln is perfect. Since I am calling readln in different places and I always need to remove the newline character I have line=line[0..$-1] all over my code. Is there are better way?

unrelated second question: Why is there no split function with a maxsplit parameter?

Reply via email to