On Sunday, 18 October 2015 at 17:48:20 UTC, Freddy wrote:
How do you call startsWith with only a predicate --- import std.algorithm; import std.ascii;bool iden(string str) { return str.startsWith!(a => a.isAlpha || a == '_'); } ---
Is this a simplified use case of some actual code you have? Otherwise, you can just do:
bool iden(string str) { auto f = str.front; return f.isAlpha || f == '_'; }