Any guide to stream (string) processing in D? | Re: Any python-like generator patterns in D?

Samuel Lampa samuel.lampa at gmail.com
Thu Feb 21 09:22:59 PST 2013


On 02/21/2013 05:55 PM, bearophile wrote:
> import std.stdio, std.algorithm, std.string;
>
> void main() {
>     auto gen = File("infile.txt")
>                .byLine()
>                .map!(line => "Line: " ~ line.chomp.toUpper);
>
>     writefln("%-(%s\n%)", gen);
> }

Cool, thanks!

// Samuel


More information about the Digitalmars-d-learn mailing list