boyerMooreFinder

Sets up Boyer-Moore matching for use with find below. By default, elements are compared for equality.

BoyerMooreFinder allocates GC memory.

BoyerMooreFinder!(binaryFun!(pred), Range)
boyerMooreFinder
(
alias pred = "a == b"
Range
)
(
Range needle
)
if (
() ||
)

Parameters

pred

Predicate used to compare elements.

needle Range

A random-access range with length and slicing.

Return Value

Type: BoyerMooreFinder!(binaryFun!(pred), Range)

An instance of BoyerMooreFinder that can be used with find() to invoke the Boyer-Moore matching algorithm for finding of needle in a given haystack.

Examples

auto bmFinder = boyerMooreFinder("TG");

string r = "TAGTGCCTGA";
// search for the first match in the haystack r
r = bmFinder.beFound(r);
assert(r == "TGCCTGA");

// continue search in haystack
r = bmFinder.beFound(r[2 .. $]);
assert(r == "TGA");

Meta