std.algorithm.startsWith only predicate
Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Oct 18 14:44:43 PDT 2015
On Sunday, October 18, 2015 17:48:18 Freddy via Digitalmars-d-learn 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 == '_');
> }
> ---
startsWith doesn't have an overload that takes only a predicate. The
existing overloads all require at least one "needle" to search for in the
"haystack." An overload that doesn't require a needle could certainly be
added, but there isn't one right now.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list