bytealg
packagestandard libraryThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Constants
- Variables
- func Compare(a, b []byte) int
- func CompareString(a, b string) int
- func Count(b []byte, c byte) int
- func CountString(s string, c byte) int
- func Cutover(n int) int
- func Equal(a, b []byte) bool
- func HashStr[T string | []byte](sep T) (uint32, uint32)
- func HashStrRev[T string | []byte](sep T) (uint32, uint32)
- func Index(a, b []byte) int
- func IndexByte(b []byte, c byte) int
- func IndexByteString(s string, c byte) int
- func IndexRabinKarp[T string | []byte](s, sep T) int
- func IndexString(a, b string) int
- func LastIndexByte(s []byte, c byte) int
- func LastIndexByteString(s string, c byte) int
- func LastIndexRabinKarp[T string | []byte](s, sep T) int
- func MakeNoZero(n int) []byte
Constants¶
const MaxBruteForce = 64
const PrimeRK = 16777619
PrimeRK is the prime base used in Rabin-Karp algorithm.
Variables¶
var MaxLenint
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.
Functions¶
funcCompareString¶added ingo1.23.0
funcCountString¶
funcCutover¶
Cutover reports the number of failures of IndexByte we should toleratebefore switching over to Index.n is the number of bytes processed so far.See the bytes.Index implementation for details.
funcEqual¶
Equal reports whether a and bare 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.
funcHashStr¶added ingo1.15
HashStr returns the hash and the appropriate multiplicativefactor for use in Rabin-Karp algorithm.
funcHashStrRev¶added ingo1.15
HashStrRev returns the hash of the reverse of sep and theappropriate multiplicative factor for use in Rabin-Karp algorithm.
funcIndex¶
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.
funcIndexByteString¶
funcIndexRabinKarp¶added ingo1.15
IndexRabinKarp uses the Rabin-Karp search algorithm to return the index of thefirst occurrence of sep in s, or -1 if not present.
funcIndexString¶
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.
funcLastIndexByte¶added ingo1.22.0
funcLastIndexByteString¶added ingo1.22.0
funcLastIndexRabinKarp¶added ingo1.22.0
LastIndexRabinKarp uses the Rabin-Karp search algorithm to return the last index of theoccurrence of sep in s, or -1 if not present.
funcMakeNoZero¶added ingo1.21.0
MakeNoZero makes a slice of length n and capacity of at least n Byteswithout zeroing the bytes (including the bytes between len and cap).It is the caller's responsibility to ensure uninitialized bytesdo not leak to the end user.
Types¶
This section is empty.