bytes

package
v0.0.0-...-286c8ad Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NUL = 0x00 // '\0' Null
	SOH = 0x01 //      Start of Header
	STX = 0x02 //      Start of Text
	ETX = 0x03 //      End of Text
	EOT = 0x04 //      End of Transmission
	ENQ = 0x05 //      Enquiry
	ACK = 0x06 //      Acknowledgement
	BEL = 0x07 // '\a' Bell
	BS  = 0x08 // '\b' Backspace
	HT  = 0x09 // '\t' Horizontal Tab
	LF  = 0x0A // '\n' Line Feed
	VT  = 0x0B // '\v' Verical Tab
	FF  = 0x0C // '\f' Form Feed
	CR  = 0x0D // '\r' Carriage return
	SO  = 0x0E //      Shift Out
	SI  = 0x0F //      Shift In
	DLE = 0x10 //      Device Idle
	DC1 = 0x11 //      Device Control 1
	DC2 = 0x12 //      Device Control 2
	DC3 = 0x13 //      Device Control 3
	DC4 = 0x14 //      Device Control 4
	NAK = 0x15 //      Negative Acknoledgement
	SYN = 0x16 //      Synchronize
	ETB = 0x17 //      End of Transmission Block
	CAN = 0x18 //      Cancel
	EM  = 0x19 //      End of Medium
	SUB = 0x1A //      Substitute
	ESC = 0x1B // '\e' Escape
	FS  = 0x1C //      Field Separator
	GS  = 0x1D //      Group Separator
	RS  = 0x1E //      Record Separator
	US  = 0x1F //      Unit Separator
	SP  = 0x20 //      Space
	DEL = 0x7F //      Delete
)

Constants for ASCII characters without printable symbols.

Variables

This section is empty.

Functions

func CommonOverlapLength

func CommonOverlapLength(b1, b2 []byte) int

CommonOverlapLength returns the length of the common overlap of two bytes

func CommonPrefixLength

func CommonPrefixLength(b1, b2 []byte) int

CommonPrefixLength returns the length of the common prefix of two bytes

func CommonSuffixLength

func CommonSuffixLength(b1, b2 []byte) int

CommonSuffixLength returns the length of the common suffix of two bytes

func FromRunes

func FromRunes(rs []rune) []byte

FromRunes trans []rune to []byte, better than []byte(string([]rune))

func FromStringUnsafe

func FromStringUnsafe(s string) []byte

FromStringUnsafe return a unsafe []byte base on string

func IndexFrom

func IndexFrom(s, substr []byte, from int) int

IndexFrom search substr position in s , with search start index from

func IsASCII

func IsASCII(b byte) bool

IsASCII return true if b is a valid ASCII character; otherwise, return false.

func IsControl

func IsControl(b byte) bool

IsControl return true if b is a control character; otherwise, return false.

func IsDigit

func IsDigit(b byte) bool

IsDigit return true if b is a decimal digit; otherwise, return false.

func IsGraph

func IsGraph(b byte) bool

IsGraph return true if b is a character with a graphic represntation; otherwise, return false.

func IsHexDigit

func IsHexDigit(b byte) bool

IsHexDigit return true if b is a hexadecimal digit; otherwise, return false.

func IsLetter

func IsLetter(b byte) bool

IsLetter return true if b is a letter; otherwise, return false.

func IsLetterOrDigit

func IsLetterOrDigit(b byte) bool

IsLetterOrDigit return true if b is a letter or decimal digit; otherwise, return false.

func IsLower

func IsLower(b byte) bool

IsLower return true if b is a lower case letter; otherwise, return false.

func IsPrint

func IsPrint(b byte) bool

IsPrint return true if b is a character with a print represntation; otherwise, return false.

func IsPunct

func IsPunct(b byte) bool

IsPunct return true if b is a punctuation character (!"#%&'()*,-./:;?@[\]_{}); otherwise, return false.

func IsSymbol

func IsSymbol(b byte) bool

IsSymbol return true if b is a symbol ($+<=>^`|~); otherwise, return false.

func IsUpper

func IsUpper(b byte) bool

IsUpper return true if b is an upper case letter; otherwise, return false.

func IsWhiteSpace

func IsWhiteSpace(b byte) bool

IsWhiteSpace return true if b is a space character (space, tab, vertical tab, form feed, carriage return, or linefeed); otherwise, return false.

func Itoa

func Itoa(num, base int) []byte

Itoa tansform int to string in []byte.

func Quote

func Quote(b []byte, mark byte) []byte

Quote mark a string.

func Random

func Random(length uint) []byte

Random return a crypto random bytes

func RandomHex

func RandomHex(length uint) []byte

RandomHex return a crypto random hex bytes

func ReadQuote

func ReadQuote(b []byte, mark byte, i uint) ([]byte, uint)

ReadQuote get a quoted string from b start at i.

func Reverse

func Reverse(b []byte) []byte

Reverse the bytes.

func StringUnsafe

func StringUnsafe(b []byte) string

StringUnsafe return a unsafe string base on []byte

func Utoa

func Utoa(num, base int) []byte

Utoa tansform uint to string in []byte.

Types

This section is empty.

Jump to

Keyboard shortcuts

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