std.algorithm.startsWith with maximal matching
Jonathan M Davis
jmdavisProg at gmx.com
Fri Jan 13 18:36:07 PST 2012
On Friday, January 13, 2012 16:48:00 H. S. Teoh wrote:
> Hi all,
>
> I'm reading the docs for startsWith(A,B...) with multiple ranges in B,
> and it seems that it will always match the *shortest* range whenever
> more than one range in B matches. Is there a way to make it always match
> the *longest* range instead? Or do I have to write my own function for
> that?
It doesn't have a way to tell it which one to match if multiple match. It just
takes the range that you're looking at and the list of elements and/or ranges
that the first range might start with. It has to have a way to decide which one
to match when multiple match, and the most efficient (and easiest) way is to
match the shortest. So, that's what it does.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list