Chaining input

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 8 05:04:07 PDT 2015


On Friday, 8 May 2015 at 11:14:43 UTC, Robert burner Schadek 
wrote:
> On Friday, 8 May 2015 at 11:00:01 UTC, Chris wrote:
>>
>> I'm sure there is room for improvement.
>>
>
> It looks like your reading some kind of comma seperated values 
> (csv).
>
> have a look at std.csv of phobos
>
> ```
> foreach(record;
>     file.byLine.joiner("\n").csvReader!(Tuple!(string, string, 
> int)))
> {
>     writefln("%s works as a %s and earns $%d per year",
>              record[0], record[1], record[2]);
> }
> ```

Yeah, I actually wanted to have a closer look at std.csv. But in 
this case the input format may change (comments, keywords etc.), 
so I might need a customized parser anyway.


More information about the Digitalmars-d-learn mailing list