ascii

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: BSD-3-Clause Imports: 1 Imported by: 1

Documentation

Overview

Package ascii provide a library for working with ASCII characters.

Index

Examples

Constants

View Source
const (
	// Letters contains list of lower and upper case characters in ASCII.
	Letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

	// LettersNumber contains list of lower and upper case characters in
	// ASCII along with numbers.
	LettersNumber = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890"

	// HexaLETTERS contains list of hexadecimal characters in upper cases.
	HexaLETTERS = "0123456789ABCDEF"
	// HexaLetters contains list of hexadecimal characters in lower and
	// upper cases.
	HexaLetters = "0123456789abcedfABCDEF"
	// Hexaletters contains list of hexadecimal characters in lower cases.
	Hexaletters = "0123456789abcedf"
)

Variables

View Source
var (
	// Spaces contains list of white spaces in ASCII.
	Spaces = []byte{'\t', '\n', '\v', '\f', '\r', ' '}
)

Functions

func IsAlnum

func IsAlnum(b byte) bool

IsAlnum will return true if byte is ASCII alphanumeric character, otherwise it will return false.

func IsAlpha

func IsAlpha(b byte) bool

IsAlpha will return true if byte is ASCII alphabet character, otherwise it will return false.

func IsDigit

func IsDigit(b byte) bool

IsDigit will return true if byte is ASCII digit, otherwise it will return false.

func IsDigits

func IsDigits(data []byte) bool

IsDigits will return true if all bytes are ASCII digit, otherwise it will return false.

func IsHex

func IsHex(b byte) bool

IsHex will return true if byte is hexadecimal number, otherwise it will return false.

func IsSpace

func IsSpace(b byte) bool

IsSpace will return true if byte is ASCII white spaces character, otherwise it will return false.

func Random

func Random(source []byte, n int) []byte

Random generate random sequence of value from source with fixed length.

This function assume that random generator has been seeded.

func ToLower

func ToLower(data *[]byte)

ToLower convert slice of ASCII characters to lower cases, in places.

Example
in := []byte("@ABCDEFGhijklmnoPQRSTUVWxyz{12345678")

ToLower(&in)

fmt.Println(string(in))
Output:

@abcdefghijklmnopqrstuvwxyz{12345678

func ToUpper

func ToUpper(data *[]byte)

ToUpper convert slice of ASCII characters to upper cases, in places.

Example
in := []byte("@ABCDEFGhijklmnoPQRSTUVWxyz{12345678")

ToUpper(&in)

fmt.Println(string(in))
Output:

@ABCDEFGHIJKLMNOPQRSTUVWXYZ{12345678

Types

This section is empty.

Jump to

Keyboard shortcuts

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