package bytealg
Import Path
internal/bytealg (on go.dev)
Dependency Relation
imports 2 packages, and imported by 7 packages
Involved Source Files
bytealg.go
compare_native.go
count_native.go
equal_generic.go
equal_native.go
index_amd64.go
index_native.go
indexbyte_native.go
compare_amd64.s
count_amd64.s
equal_amd64.s
index_amd64.s
indexbyte_amd64.s
Package-Level Functions (total 21, in which 15 are exported)
func CountString(s string, c byte) int
Cutover reports the number of failures of IndexByte we should tolerate
before switching over to Index.
n is the number of bytes processed so far.
See the bytes.Index implementation for details.
Equal reports whether a and b
are the same length and contain the same bytes.
A nil argument is equivalent to an empty slice.
Equal is equivalent to bytes.Equal.
It is provided here for convenience,
because some packages cannot depend on bytes.
HashStr returns the hash and the appropriate multiplicative
factor for use in Rabin-Karp algorithm.
HashStrBytes returns the hash and the appropriate multiplicative
factor for use in Rabin-Karp algorithm.
HashStrRev returns the hash of the reverse of sep and the
appropriate multiplicative factor for use in Rabin-Karp algorithm.
HashStrRevBytes returns the hash of the reverse of sep and the
appropriate multiplicative factor for use in Rabin-Karp algorithm.
Index returns the index of the first instance of b in a, or -1 if b is not present in a.
Requires 2 <= len(b) <= MaxLen.
func IndexByteString(s string, c byte) int
IndexRabinKarp uses the Rabin-Karp search algorithm to return the index of the
first occurrence of substr in s, or -1 if not present.
IndexRabinKarpBytes uses the Rabin-Karp search algorithm to return the index of the
first occurrence of substr in s, or -1 if not present.
IndexString returns the index of the first instance of b in a, or -1 if b is not present in a.
Requires 2 <= len(b) <= MaxLen.
Package-Level Variables (only one, which is exported)
MaxLen is the maximum length of the string to be searched for (argument b) in Index.
If MaxLen is not 0, make sure MaxLen >= 4.
Package-Level Constants (total 7, in which 2 are exported)
const MaxBruteForce = 64
PrimeRK is the prime base used in Rabin-Karp algorithm.
The pages are generated with Golds v0.4.2. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |