replaceFirst, findPieces, and takeExactly

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jan 23 07:12:34 PST 2011


On 1/23/11 1:22 AM, Jim wrote:
> Andrei Alexandrescu Wrote:
>> I suspect there might be a simple and intuitive way to define a family
>> of functions that give you whatever portions of the find you're
>> interested in (before, match, after, before and match, match and after).
>> That could be either a naming convention or a template argument. Any
>> ideas, let me know.
>
>
> splitAt
> splitBefore
> splitAfter
>
> ?

That's a good suggestion, thanks. One issue is that if the element type 
of the range is integral, there is confusion (did you mean to split at 
position k?).

I decided to go with these:

http://d-programming-language.org/cutting-edge/phobos/std_algorithm.html#findSplit


Andrei


More information about the Digitalmars-d mailing list