Can you read the next line while iterating over byLine?
Daniel Kozak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 2 11:30:32 PST 2017
More range aproach, untested written on the fly from mobile phone
import std.stdio : File;
import std.range : chunks;
import.std.algorithm : map, filter, array;
void main()
{
auto r = File("text.txt").byLine
.filter!(a=>a.length)
.chunks(2)
.map!(a=>[a[0].dup, a[1].dup])
.array;
writeln(r);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20170202/f5411e9f/attachment.html>
More information about the Digitalmars-d-learn
mailing list