csvReader read file byLine()?
timon.gehr at gmx.ch
Thu Jun 21 05:34:28 PDT 2012
On 06/21/2012 02:17 PM, Jens Mueller wrote:
> 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?
You might make use of std.algorithm.joiner.
More information about the Digitalmars-d