Splitting Ranges using Lambda Predicates

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 10 14:34:17 PDT 2014


On Tuesday, 10 June 2014 at 21:26:50 UTC, monarch_dodr
> What exactly are you requesting though?
> - Split on the "edge" lowercase to uppercase?
> - Split on uppercase but keep the uppercase element?

Thinking about this more: Do you *actually* have two different 
predicates, or are they mutually exclusive? EG: predicate 
"isUpper", and split on a false->true?

Either way, it shouldn't be too hard to implement. Base it off 
"splitter!pred", which is actually quite trivial. AFAIK, your 
requirements could even make it simpler, since you don't need to 
"skip" the splitter element (which, for strings, can actually be 
tricky business...).

You'd just have to use 2 calls to find though, for "both your 
predicates" or for "not predicate then predicate".


More information about the Digitalmars-d-learn mailing list