D2: std.algorithm.find, but get part before what you were searching for

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Thu Mar 4 00:48:02 PST 2010

Jonathan M Davis wrote:
> std.algorithm.find() returns the rest of the range starting at what you were 
> searching for (or an empty range if it wasn't in the given range). Is there  
> a function in phobos which does a find but returns everything _before_ what 
> you're searching for?
> I can't find one that will do that, and I don't see an obvious way of 
> combining functions to get it. Naturally, I'll roll my own function for it 
> if I have to, but if there's already a way to do it in phobos semi-cleanly, 
> I'd probably prefer to do that. So, I'm enquiring as to whether anyone here 
> knows of such a function or combination of functions. Thanks.
> - Jonathan M Davis

Would std.algorithm.until() be what you're looking for?



More information about the Digitalmars-d-learn mailing list