bytes package - bytes - Go Packages
Package bytes implements functions for the manipulation of byte slices. It is analogous to the facilities of the strings package. MinRead is the minimum slice size passed to a Read call by Buffer.ReadFrom. As long as the Buffer has at least MinRead bytes beyond what is required to hold the contents of r, ReadFrom will not grow the underlying buffer. ErrTooLarge is passed to panic if memory cannot be allocated to store data in a buffer. Clone returns a copy of b[:len(b)]. The result may have additional unused capacity. Clone(nil) returns nil. Compare returns an integer comparing two byte slices lexicographically. The result will be 0 if a == b, -1 if a b. A nil argument is equivalent to an empty slice. Contains reports whether subslice is within b. ContainsAny reports whether any of the UTF-8-encoded code points in chars are within b. ContainsRune reports whether the rune is contained in the UTF-8-encoded byte slice b. Count counts the number of non-overlapping instan
Documentation ¶ Rendered for linux/amd64 windows/amd64 darwin/amd64 js/wasm Overview ¶ Package bytes implements functions for the manipulation of byte slices. It is analogous to the facilities of the strings package. Index ¶ Constants Variables func Clone(b []byte) []byte func Compare(a, b []byte) int func Contains(b, subslice []byte) bool func ContainsAny(b []byte, chars string) bool func ContainsFunc(b []byte, f func(rune) bool) bool func ContainsRune(b []byte, r rune) bool func Count(s, sep []byte) int func Cut(s, sep []byte) (before, after []byte, found bool) func CutPrefix(s, prefix []byt
related reading
- Go Slices: usage and internals - The Go Programming Languagego.dev
- The Slice Type - The Rust Programming Languagedoc.rust-lang.org
- sync package - sync - Go Packagespkg.go.dev
- gob package - encoding/gob - Go Packagespkg.go.dev
- Rust Language Cheat Sheetcheats.rs
- Go go-to guide · YourBasicyourbasic.org
- Pointers & errors | Learn Go with testsquii.gitbook.io
- Demystifying Function Parameters in Go- Alex Edwardsalexedwards.net
- cmp package - github.com/google/go-cmp/cmp - Go Packagespkg.go.dev
- Package names - The Go Programming Languagego.dev
- Storing UTF-8 Encoded Text with Strings - The Rust Programming Languagedoc.rust-lang.org
- The Go Programming Language Specification - The Go Programming Languagego.dev