Help us shape the future of Go! Take the 2026 Go Developer Survey

bytesearch

package module
v0.0.0-...-cef08dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2015 License: MIT Imports: 2 Imported by: 0

README

bytesearch Build Status

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

Docs: https://godoc.org/github.com/shawngardner/bytesearch

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL