bytes

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package bytes contains generated code by adptool.

Package bytes provides a rich set of functions for the manipulation of byte slices.

This package is a generated adapter and mirrors the public API of the standard Go library's `bytes` package. It offers a convenient way to access the rich set of standard byte slice utilities within the generic context of this library.

For detailed information on the behavior of specific functions, please refer to the official Go documentation for the `bytes` package.

Index

Constants

View Source
const MinRead = bytes.MinRead

Variables

View Source
var ErrTooLarge = bytes.ErrTooLarge

Functions

func Clone

func Clone(b []byte) []byte

func Compare

func Compare(a, b []byte) int

func Contains

func Contains(b, subslice []byte) bool

func ContainsAny

func ContainsAny(b []byte, chars string) bool

func ContainsFunc

func ContainsFunc(b []byte, f func(rune) bool) bool

func ContainsRune

func ContainsRune(b []byte, r rune) bool

func Count

func Count(s, sep []byte) int

func Cut

func Cut(s, sep []byte) (before, after []byte, found bool)

func CutPrefix

func CutPrefix(s, prefix []byte) (after []byte, found bool)

func CutSuffix

func CutSuffix(s, suffix []byte) (before []byte, found bool)

func Equal

func Equal(a, b []byte) bool

func EqualFold

func EqualFold(s, t []byte) bool

func Fields

func Fields(s []byte) [][]byte

func FieldsFunc

func FieldsFunc(s []byte, f func(rune) bool) [][]byte

func FieldsFuncSeq added in v0.6.0

func FieldsFuncSeq(s []byte, f func(rune) bool) iter.Seq[[]byte]

func FieldsSeq added in v0.6.0

func FieldsSeq(s []byte) iter.Seq[[]byte]

func HasPrefix

func HasPrefix(s, prefix []byte) bool

func HasSuffix

func HasSuffix(s, suffix []byte) bool

func Index

func Index(s, sep []byte) int

func IndexAny

func IndexAny(s []byte, chars string) int

func IndexByte

func IndexByte(b []byte, c byte) int

func IndexFunc

func IndexFunc(s []byte, f func(r rune) bool) int

func IndexRune

func IndexRune(s []byte, r rune) int

func Join

func Join(s [][]byte, sep []byte) []byte

func LastIndex

func LastIndex(s, sep []byte) int

func LastIndexAny

func LastIndexAny(s []byte, chars string) int

func LastIndexByte

func LastIndexByte(s []byte, c byte) int

func LastIndexFunc

func LastIndexFunc(s []byte, f func(r rune) bool) int

func Lines added in v0.6.0

func Lines(s []byte) iter.Seq[[]byte]

func Map

func Map(mapping func(r rune) rune, s []byte) []byte

func NewBuffer

func NewBuffer(buf []byte) *bytes.Buffer

func NewBufferString

func NewBufferString(s string) *bytes.Buffer

func NewReader

func NewReader(b []byte) *bytes.Reader

func Repeat

func Repeat(b []byte, count int) []byte

func Replace

func Replace(s, old, new []byte, n int) []byte

func ReplaceAll

func ReplaceAll(s, old, new []byte) []byte

func Runes

func Runes(s []byte) []rune

func Split

func Split(s, sep []byte) [][]byte

func SplitAfter

func SplitAfter(s, sep []byte) [][]byte

func SplitAfterN

func SplitAfterN(s, sep []byte, n int) [][]byte

func SplitAfterSeq added in v0.6.0

func SplitAfterSeq(s, sep []byte) iter.Seq[[]byte]

func SplitN

func SplitN(s, sep []byte, n int) [][]byte

func SplitSeq added in v0.6.0

func SplitSeq(s, sep []byte) iter.Seq[[]byte]

func Title

func Title(s []byte) []byte

func ToLower

func ToLower(s []byte) []byte

func ToLowerSpecial

func ToLowerSpecial(c unicode.SpecialCase, s []byte) []byte

func ToTitle

func ToTitle(s []byte) []byte

func ToTitleSpecial

func ToTitleSpecial(c unicode.SpecialCase, s []byte) []byte

func ToUpper

func ToUpper(s []byte) []byte

func ToUpperSpecial

func ToUpperSpecial(c unicode.SpecialCase, s []byte) []byte

func ToValidUTF8

func ToValidUTF8(s, replacement []byte) []byte

func Trim

func Trim(s []byte, cutset string) []byte

func TrimFunc

func TrimFunc(s []byte, f func(r rune) bool) []byte

func TrimLeft

func TrimLeft(s []byte, cutset string) []byte

func TrimLeftFunc

func TrimLeftFunc(s []byte, f func(r rune) bool) []byte

func TrimPrefix

func TrimPrefix(s, prefix []byte) []byte

func TrimRight

func TrimRight(s []byte, cutset string) []byte

func TrimRightFunc

func TrimRightFunc(s []byte, f func(r rune) bool) []byte

func TrimSpace

func TrimSpace(s []byte) []byte

func TrimSuffix

func TrimSuffix(s, suffix []byte) []byte

Types

type Buffer

type Buffer = bytes.Buffer

type Bytes

type Bytes []byte

Bytes is a type alias for []byte to provide methods.

func FromString

func FromString(s string) Bytes

FromString converts a string to a Bytes slice.

func (Bytes) Clone added in v0.9.0

func (b Bytes) Clone() Bytes

Clone returns a copy of the Bytes slice.

func (Bytes) Contains

func (b Bytes) Contains(sub []byte) bool

Contains reports whether sub is within b.

func (Bytes) FindString

func (b Bytes) FindString(s string) int

FindString returns the index of the first instance of s in b, or -1 if s is not present in b.

func (Bytes) HasPrefix

func (b Bytes) HasPrefix(prefix []byte) bool

HasPrefix tests whether the byte slice b begins with prefix.

func (Bytes) HasSuffix

func (b Bytes) HasSuffix(suffix []byte) bool

HasSuffix tests whether the byte slice b ends with suffix.

func (Bytes) Index

func (b Bytes) Index(sub []byte) int

Index returns the index of the first instance of sub in b, or -1 if sub is not present in b.

func (Bytes) Read

func (b Bytes) Read(offset int, limit int) []byte

Read returns a slice of the Bytes s beginning at offset and length limit.

func (Bytes) ReadString

func (b Bytes) ReadString(offset int, limit int) string

ReadString returns a string of the Bytes s beginning at offset and length limit.

func (Bytes) Replace

func (b Bytes) Replace(old, replacement []byte, n int) []byte

Replace returns a copy of the slice with the first n non-overlapping instances of old replaced by replacement.

func (Bytes) String

func (b Bytes) String() string

String converts the Bytes slice to a string.

func (Bytes) Trim

func (b Bytes) Trim(cutset string) []byte

Trim returns a slice of the bytes, with all leading and trailing bytes contained in cutset removed.

func (Bytes) TrimPrefix

func (b Bytes) TrimPrefix(prefix []byte) []byte

TrimPrefix returns b without the provided leading prefix.

func (Bytes) TrimSpace

func (b Bytes) TrimSpace() []byte

TrimSpace returns a slice of the bytes, with all leading and trailing white space removed.

func (Bytes) TrimSuffix

func (b Bytes) TrimSuffix(suffix []byte) []byte

TrimSuffix returns b without the provided trailing suffix.

type Reader

type Reader = bytes.Reader

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL