Documentation ¶
Index ¶
Constants ¶
const PrimeRK = 16777619
Variables ¶
This section is empty.
Functions ¶
func HashStrBytes ¶
HashStrBytes returns the hash and the appropriate multiplicative factor for use in Rabin-Karp algorithm.
func Index ¶
Index returns the index of the first instance of sep in s, or -1 if sep is not present in s.
func IndexRabinKarpBytes ¶
IndexRabinKarpBytes uses the Rabin-Karp search algorithm to return the index of the first occurrence of substr in s, or -1 if not present.
Types ¶
type BytesReplacingReader ¶
type BytesReplacingReader struct {
// contains filtered or unexported fields
}
BytesReplacingReader allows transparent replacement of a given token during read operation.
func NewBytesReplacingReader ¶
func NewBytesReplacingReader(r io.Reader, search, replace []byte) *BytesReplacingReader
NewBytesReplacingReader creates a new `*BytesReplacingReader`. `search` cannot be nil/empty. `replace` can.
func (*BytesReplacingReader) Read ¶
func (r *BytesReplacingReader) Read(p []byte) (int, error)
Read implements the `io.Reader` interface.
func (*BytesReplacingReader) Reset ¶
func (r *BytesReplacingReader) Reset(r1 io.Reader, search1, replace1 []byte) *BytesReplacingReader
Reset allows reuse of a previous allocated `*BytesReplacingReader` for buf allocation optimization. `search` cannot be nil/empty. `replace` can.