findFirstOfAnyInOrder

Find First Occurrence any of needles in haystack.

Like to std.algorithm.find but takes an array of needles as argument instead of a variadic list of key needle arguments. Return found range plus index into needles starting at 1 upon.

Tuple!(R, size_t)
findFirstOfAnyInOrder
(
alias pred = `a == b`
R
)
(,
const R[] needles
)

Examples

assert(`abc`.findFirstOfAnyInOrder([`x`]) == tuple(``, 0UL));
assert(`abc`.findFirstOfAnyInOrder([`a`]) == tuple(`abc`, 1UL));
assert(`abc`.findFirstOfAnyInOrder([`c`]) == tuple(`c`, 1UL));
assert(`abc`.findFirstOfAnyInOrder([`a`, `b`]) == tuple(`abc`, 1UL));
assert(`abc`.findFirstOfAnyInOrder([`a`, `b`]) == tuple(`abc`, 1UL));
assert(`abc`.findFirstOfAnyInOrder([`x`, `b`]) == tuple(`bc`, 2UL));

Meta