BoyerMooreFinder

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

BoyerMooreFinder allocates GC memory.

Constructors

this
this(Range needle)

Members

Aliases

opDollar
alias opDollar = length

Functions

beFound
Range beFound(Range haystack)

Properties

length
size_t length [@property getter]

Parameters

pred

Predicate used to compare elements.

Return Value

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