findPopAfter

Variant of findSplitAfter that destructively pops everything up to, including, needle from haystack.

findPopAfter
(
alias pred = `a == b`
R1
R2
)
(
ref R1 haystack
,)
if (
isForwardRange!R1 &&
isForwardRange!R2
)

Examples

auto source = `xyz`;
auto haystack = source;
const needle = `y`;
auto pop = haystack.findPopAfter(needle);
assert(pop == `xy`);
assert(haystack == `z`);
auto source = `xy`;
auto haystack = source;
const needle = `z`;
auto pop = haystack.findPopAfter(needle);
assert(pop is null);
assert(!pop);
assert(haystack == source);

Meta