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

Jonathan M Davis jmdavisProg at gmail.com
Thu Mar 4 00:38:20 PST 2010


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


More information about the Digitalmars-d-learn mailing list