Timon Gehr wrote: > On 06/21/2012 02:17 PM, Jens Mueller wrote: > >Hi, > > > >I used std.csv for reading a CSV file. > >Thanks a lot to Jesse for writing and adding std.csv to Phobos. > >Using it is fairly straightforward but I miss one thing. Very commonly > >you need to read a CSV file. With std.csv that boils down to > > > >auto records = csvReader!(Record)(readText(filename)); > > > >But csvReader won't parse from File(filename, "r").byLine() even though > >that is an InputRange, isn't it? That means I always have to use > >readText. All IO happens that very moment. > >Shouldn't the csvReader support lazy reading from a file like this > > > >auto file = File(filename, "r"); > >auto records = csvReader!(Record)(file.byLine()); > > > >Am I missing something? Was this left out for a reason or an oversight? > > > >Jens > > You might make use of std.algorithm.joiner.
You mean like auto file = File(filename, "r"); auto records = csvReader!(Record)(joiner(file.byLine(KeepTerminator.yes))); Then a CSVException is raised. Don't know why. Have to investigate. Thanks for the pointer. BTW std.stdio should publicly import std.string.KeepTerminator, shouldn't it. Otherwise you have to import it yourself. Jens
