strutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: AGPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(str string) []byte

Bytes returns the byte slice representation of the string without copying. The byte slice must NOT be changed

func BytesWithoutNullChar

func BytesWithoutNullChar(byt []byte) []byte

BytesWithoutNullChar returns a new byte slice with the null characters removed

func String

func String(byt []byte) string

String returns the string representation of the byte slice without copying

Types

type HexOrString

type HexOrString []byte

HexOrString represents a string in either hex or printable ASCII

func (HexOrString) IsPrint

func (h HexOrString) IsPrint() bool

IsPrint indicates whether the value is printable

func (HexOrString) MarshalJSON

func (h HexOrString) MarshalJSON() ([]byte, error)

MarshalJSON marshals to JSON

func (HexOrString) String

func (h HexOrString) String() string

func (*HexOrString) UnmarshalJSON

func (h *HexOrString) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals from JSON

Jump to

Keyboard shortcuts

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