Movatterモバイル変換


[0]ホーム

URL:


bytealg

packagestandard library
go1.25.2Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License:BSD-3-ClauseImports:2Imported by:0

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Index

Constants

View Source
const MaxBruteForce = 64
View Source
const PrimeRK = 16777619

PrimeRK is the prime base used in Rabin-Karp algorithm.

Variables

View Source
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

funcCompare

func Compare(a, b []byte)int

funcCompareStringadded ingo1.23.0

func CompareString(a, bstring)int

funcCount

func Count(b []byte, cbyte)int

funcCountString

func CountString(sstring, cbyte)int

funcCutover

func Cutover(nint)int

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

func Equal(a, b []byte)bool

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.

funcHashStradded ingo1.15

func HashStr[Tstring | []byte](sep T) (uint32,uint32)

HashStr returns the hash and the appropriate multiplicativefactor for use in Rabin-Karp algorithm.

funcHashStrRevadded ingo1.15

func HashStrRev[Tstring | []byte](sep T) (uint32,uint32)

HashStrRev returns the hash of the reverse of sep and theappropriate multiplicative factor for use in Rabin-Karp algorithm.

funcIndex

func Index(a, b []byte)int

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.

funcIndexByte

func IndexByte(b []byte, cbyte)int

funcIndexByteString

func IndexByteString(sstring, cbyte)int

funcIndexRabinKarpadded ingo1.15

func IndexRabinKarp[Tstring | []byte](s, sep T)int

IndexRabinKarp uses the Rabin-Karp search algorithm to return the index of thefirst occurrence of sep in s, or -1 if not present.

funcIndexString

func IndexString(a, bstring)int

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.

funcLastIndexByteadded ingo1.22.0

func LastIndexByte(s []byte, cbyte)int

funcLastIndexByteStringadded ingo1.22.0

func LastIndexByteString(sstring, cbyte)int

funcLastIndexRabinKarpadded ingo1.22.0

func LastIndexRabinKarp[Tstring | []byte](s, sep T)int

LastIndexRabinKarp uses the Rabin-Karp search algorithm to return the last index of theoccurrence of sep in s, or -1 if not present.

funcMakeNoZeroadded ingo1.21.0

func MakeNoZero(nint) []byte

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.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp