Documentation ¶
Index ¶
- func BytesToString(b []byte) string
- func Compare(b, s []byte) int
- func Contains(b, s []byte) bool
- func Copy(b []byte) []byte
- func Equal(b, s []byte) bool
- func EqualFold(b, s []byte) bool
- func Fields(b []byte) [][]byte
- func FieldsFunc(b []byte, fn func(rune) bool) [][]byte
- func HasBytePrefix(b []byte, c byte) bool
- func HasByteSuffix(b []byte, c byte) bool
- func HasPrefix(b, s []byte) bool
- func HasSuffix(b, s []byte) bool
- func Index(b, s []byte) int
- func IndexAny(b []byte, s string) int
- func IndexByte(b []byte, c byte) int
- func IndexFunc(b []byte, fn func(rune) bool) int
- func IndexRune(b []byte, r rune) int
- func LastIndex(b, s []byte) int
- func LastIndexAny(b []byte, s string) int
- func LastIndexByte(b []byte, c byte) int
- func LastIndexFunc(b []byte, fn func(rune) bool) int
- func NewReader(b []byte) *bytes.Reader
- func Replace(b, s, r []byte, c int) []byte
- func ReplaceAll(b, s, r []byte) []byte
- func Split(b, s []byte) [][]byte
- func SplitAfter(b, s []byte) [][]byte
- func SplitAfterN(b, s []byte, c int) [][]byte
- func SplitN(b, s []byte, c int) [][]byte
- func StringToBytes(s string) []byte
- func ToLower(b []byte)
- func ToUpper(b []byte)
- func TrimBytePrefix(b []byte, c byte) []byte
- func TrimByteSuffix(b []byte, c byte) []byte
- func TrimPrefix(b, s []byte) []byte
- func TrimSuffix(b, s []byte) []byte
- type Buffer
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) Cap() int
- func (b *Buffer) Delete(start int64, size int)
- func (b *Buffer) DeleteByte(index int)
- func (b *Buffer) Grow(size int)
- func (b *Buffer) Guarantee(size int)
- func (b *Buffer) Insert(index int64, p []byte)
- func (b *Buffer) InsertByte(index int64, c byte)
- func (b *Buffer) Len() int
- func (b *Buffer) Reset()
- func (b *Buffer) Shift(start int64, size int)
- func (b *Buffer) ShiftByte(index int)
- func (b *Buffer) String() string
- func (b *Buffer) StringPtr() string
- func (b *Buffer) Truncate(size int)
- func (b *Buffer) Write(p []byte) (int, error)
- func (b *Buffer) WriteAt(p []byte, start int64) (int, error)
- func (b *Buffer) WriteByte(c byte) error
- func (b *Buffer) WriteRune(r rune) (int, error)
- func (b *Buffer) WriteString(s string) (int, error)
- func (b *Buffer) WriteStringAt(s string, start int64) (int, error)
- type Bytes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
BytesToString returns byte slice cast to string via the "unsafe" package
func FieldsFunc ¶
FieldsFunc is a direct call-through to standard library bytes.FieldsFunc()
func HasBytePrefix ¶
HasBytePrefix returns whether b has the provided byte prefix
func HasByteSuffix ¶
HasByteSuffix returns whether b has the provided byte suffix
func LastIndexAny ¶
LastIndexAny is a direct call-through to standard library bytes.LastIndexAny()
func LastIndexByte ¶
LastIndexByte is a direct call-through to standard library bytes.LastIndexByte()
func LastIndexFunc ¶
LastIndexFunc is a direct call-through to standard library bytes.LastIndexFunc()
func ReplaceAll ¶
ReplaceAll is a direct call-through to standard library bytes.ReplaceAll()
func SplitAfter ¶
SplitAfter is a direct call-through to standard library bytes.SplitAfter()
func SplitAfterN ¶
SplitAfterN is a direct call-through to standard library bytes.SplitAfterN()
func StringToBytes ¶
StringToBytes returns the string cast to string via the "unsafe" and "reflect" packages
func ToLower ¶
func ToLower(b []byte)
ToLower offers a faster ToLower implementation using a lookup table
func ToUpper ¶
func ToUpper(b []byte)
ToUpper offers a faster ToUpper implementation using a lookup table
func TrimBytePrefix ¶
HasBytePrefix returns b without the provided leading byte
func TrimByteSuffix ¶
TrimByteSuffix returns b without the provided trailing byte
func TrimPrefix ¶
TrimPrefix is a direct call-through to standard library bytes.TrimPrefix()
func TrimSuffix ¶
TrimSuffix is a direct call-through to standard library bytes.TrimSuffix()
Types ¶
type Buffer ¶
type Buffer struct {
B []byte
}
Buffer is a very simple buffer implementation that allows access to and reslicing of the underlying byte slice.
func (*Buffer) DeleteByte ¶
func (*Buffer) InsertByte ¶
type Bytes ¶
type Bytes interface { // Bytes returns the byte slice content Bytes() []byte // String returns byte slice cast directly to string, this // will cause an allocation but comes with the safety of // being an immutable Go string String() string // StringPtr returns byte slice cast to string via the unsafe // package. This comes with the same caveats of accessing via // .Bytes() in that the content is liable change and is NOT // immutable, despite being a string type StringPtr() string }
Bytes defines a standard way of retrieving the content of a byte buffer of some-kind.