Looking for an equivalent to C++ std::getline in D

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 8 14:37:17 PDT 2017


On 05/06/2017 02:24 AM, Stanislav Blinov wrote:

 > auto input = args[1].splitter('/').filter!((string s) { return !s.empty;
 > })();
 >
 > or a template lambda:
 >
 > auto input = arga[1].splitter('/').filter!((s) => !s.empty)();

Not necessarily better but worth mentioning:

     import std.functional : not;

     auto input = args[1].splitter('/').filter!(not!empty)();

Ali



More information about the Digitalmars-d-learn mailing list