Multi-Prefix Version of skipOver()
    "Nordlöw" via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Nov 15 08:06:56 PST 2014
    
    
  
On Saturday, 15 November 2014 at 14:41:29 UTC, Nordlöw wrote:
> What's currently the fastest way of removing the largest 
> matching prefix from an array of prefix arrays from an array in 
> D like
>
>     auto x = "first_second";
>     x.skipOverLargestMatch(["fir", "first"]);
>     assert( == "_second");
>
>     auto x = "first_second";
>     x.skipOverLargestMatch(["fir"]);
>     assert( == "st_second");
>
> The list of prefixes is preferrably dynamically generated but 
> can also a variadic list of arguments if necessary.
>
> I guess we could reuse variadic find in the static case.
So I hacked together skipOverShortestOf at
https://github.com/nordlow/justd/blob/master/skip_ex.d#L39
Now I need help figuring out how to implement skipOverLongestOf 
hopefully by reusing
skipOverShortestOf.
Other comments would also be great.
    
    
More information about the Digitalmars-d-learn
mailing list