package zbyte
import "zgo.at/zstd/zbyte"
Package zbyte implements functions for byte slices.
Index ¶
- func Binary(b []byte) bool
- func ElideLeft(b []byte, n int) []byte
- func ElideRight(b []byte, n int) []byte
- func HasPrefixes(b []byte, prefixes ...[]byte) bool
- func HasSuffixes(b []byte, suffixes ...[]byte) bool
- func IndexAll(s, find []byte) []int
Functions ¶
func Binary ¶
Binary reports if this looks like binary data.
Something is considered binary if it contains a NULL byte in the first 8000 bytes.
This is the same check as git uses; see buffer_is_binary().
func ElideLeft ¶
ElideLeft returns the "n" left bytes.
func ElideRight ¶
ElideRight returns the "n" right bytes.
func HasPrefixes ¶
HasPrefixes tests whether the byte slice b starts with any of the prefixes.
Identical to:
bytes.HasPrefix(s, "one") || bytes.HasPrefix(s, "two")
func HasSuffixes ¶
HasSuffixes tests whether the byte slice b ends with any of the suffixes.
Identical to:
bytes.HasSuffix(s, "one") || bytes.HasSuffix(s, "two")
func IndexAll ¶
IndexAll finds all occurrences of "find".
Source Files ¶
zbyte.go
- Version
- v0.0.0-20240930202209-a63c3335042a (latest)
- Published
- Sep 30, 2024
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 2 days ago –
Tools for package owners.