Using lazy code to process large files

Martin DraĊĦar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 2 05:23:13 PDT 2017


Dne 2.8.2017 v 14:11 Daniel Kozak via Digitalmars-d-learn napsal(a):
> import std.stdio;
> import std.algorithm;
> 
> void main()
> {
> 
> 
> auto input  = ["... some text, another text", "some,another","...so,an"];
> 
> auto result = input.filter!(a => a.startsWith("..."))
>           .map!(a=>a.splitter(",").map!(a=>a.stripLeft(' ')))
>   .map!(a=>a.joiner(","));
> writeln(result);
> }


Thanks a lot. That did the trick.

Martin



More information about the Digitalmars-d-learn mailing list