delegate object instead of a literal

Joel Christensen joelcnz at gmail.com
Mon Aug 15 02:25:26 PDT 2011


Ok, this is a good one I think.

import std.string, std.algorithm, std.functional;

bool isANum( dchar chr ) {
         return inPattern( chr, digits ~ `"+-.` );
}

void main() {
     auto input = `abc123`;
     auto indexEnd = -1;

     indexEnd = count!( not!isANum )( input );
     assert( indexEnd == 3 );
}



More information about the Digitalmars-d-learn mailing list