zbyte

package
v0.0.0-...-d785515 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 1 Imported by: 2

Documentation

Overview

Package zbyte implements functions for byte slices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Binary

func Binary(b []byte) bool

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

func ElideLeft(b []byte, n int) []byte

ElideLeft returns the "n" left bytes.

func ElideRight

func ElideRight(b []byte, n int) []byte

ElideRight returns the "n" right bytes.

func HasPrefixes

func HasPrefixes(b []byte, prefixes ...[]byte) bool

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

func HasSuffixes(b []byte, suffixes ...[]byte) bool

HasSuffixes tests whether the byte slice b ends with any of the suffixes.

Identical to:

bytes.HasSuffix(s, "one") || bytes.HasSuffix(s, "two")

Types

This section is empty.

Jump to

Keyboard shortcuts

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