Documentation
¶
Overview ¶
Utilities to find a byte sequence within another byte sequence using fast search algorithms.
The supported algorithms:
Brute Force (not recommended, useful for benchmarking) Boyer-Moore Boyer-Moore-Horspool Knuth-Morris-Pratt
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteSearcher ¶
type ByteSearcher interface {
Search(haystack []byte) int
SearchAll(haystack []byte) []int
// contains filtered or unexported methods
}
func NewByteSearcher ¶
func NewByteSearcher(searchType SearchType, needle []byte) (ByteSearcher, error)
Create a new ByteSearcher with the given algorithm and needle. Any pre-computations will be performed so the returned ByteSearcher is re-usable (and thread-safe)
type SearchType ¶
type SearchType int8
Enumeration of various search algorithms
const ( BRUTE_FORCE SearchType = 0 BOYER_MOORE SearchType = 1 BOYER_MOORE_HORSPOOL SearchType = 2 KNUTH_MORRIS_PRATT SearchType = 3 )
func (SearchType) String ¶
func (i SearchType) String() string
Click to show internal directories.
Click to hide internal directories.