module FastSearch: sig end
The functions in this module are for fast searching for the same
substring multiple times.
The idea is to take some extra time to analyze the search string
to make each individual search for it go faster. These functions use
the Boyer-Moore-Horspool algorithm.
type
t
The type of an analyzed search string
val study : string -> t
Analyze a search string
val index : t -> string -> int
index needle haystack
returns the position in haystack where
needle starts.
Raises Not_found
if the substring isn't present.
val index_from : t -> string -> int -> int
index_from needle haystack pos
returns the position in
haystack where needle starts, starting looking at pos.
RaisesNot_found
if the substring isn't present.
Invalid_argument
if the positition is outside of haystack.