byteutil

package
v0.0.0-...-c18495b Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2018 License: BSD-2-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package byteutil provides various operations on bytes and byte strings.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToLower

func ByteToLower(b byte) byte
Example
fmt.Printf("%c\n", ByteToLower('a'))
fmt.Printf("%c\n", ByteToLower('A'))
fmt.Printf("%c\n", ByteToLower('0'))
fmt.Printf("%c\n", ByteToLower('.'))
Output:

a
a
0
.

func ByteToUpper

func ByteToUpper(b byte) byte
Example
fmt.Printf("%c\n", ByteToUpper('a'))
fmt.Printf("%c\n", ByteToUpper('A'))
fmt.Printf("%c\n", ByteToUpper('0'))
fmt.Printf("%c\n", ByteToUpper('.'))
Output:

A
A
0
.

func IndexAny

func IndexAny(s, chars string) int
Example
fmt.Println(IndexAny("abcdefghijklmnopqrstuvwxyz", "zyx"))
Output:

23

func IndexAnyTable

func IndexAnyTable(s string, t *[256]bool) int
Example
var t [256]bool
t['z'], t['y'], t['x'] = true, true, true
fmt.Println(IndexAnyTable("abcdefghijklmnopqrstuvwxyz", &t))
Output:

23

func IsAlphaNum

func IsAlphaNum(b byte) bool
Example
fmt.Println(IsAlphaNum('0'))
fmt.Println(IsAlphaNum('9'))
fmt.Println(IsAlphaNum('a'))
fmt.Println(IsAlphaNum('Z'))
fmt.Println(IsAlphaNum('.'))
Output:

true
true
true
true
false

func IsDigit

func IsDigit(b byte) bool
Example
fmt.Println(IsDigit('0'))
fmt.Println(IsDigit('9'))
fmt.Println(IsDigit('a'))
Output:

true
true
false

func IsHexDigit

func IsHexDigit(b byte) bool
Example
fmt.Println(IsHexDigit('0'))
fmt.Println(IsHexDigit('9'))
fmt.Println(IsHexDigit('a'))
fmt.Println(IsHexDigit('F'))
fmt.Println(IsHexDigit('G'))
Output:

true
true
true
true
false

func IsLetter

func IsLetter(b byte) bool
Example
fmt.Println(IsLetter('a'))
fmt.Println(IsLetter('Z'))
fmt.Println(IsLetter('0'))
Output:

true
true
false

func IsLowercaseLetter

func IsLowercaseLetter(b byte) bool
Example
fmt.Println(IsLowercaseLetter('a'))
fmt.Println(IsLowercaseLetter('z'))
fmt.Println(IsLowercaseLetter('A'))
Output:

true
true
false

func IsUppercaseLetter

func IsUppercaseLetter(b byte) bool
Example
fmt.Println(IsUppercaseLetter('A'))
fmt.Println(IsUppercaseLetter('Z'))
fmt.Println(IsUppercaseLetter('a'))
Output:

true
true
false

func ToLower

func ToLower(s string) string
Example
fmt.Println(ToLower(".012345abcdefABCDEFабвгд"))
Output:

.012345abcdefabcdefабвгд

func ToUpper

func ToUpper(s string) string
Example
fmt.Println(ToUpper(".012345abcdefABCDEFабвгд"))
Output:

.012345ABCDEFABCDEFабвгд

func Unhex

func Unhex(d byte) byte
Example
fmt.Println(Unhex('0'))
fmt.Println(Unhex('9'))
fmt.Println(Unhex('a'))
fmt.Println(Unhex('A'))
fmt.Println(Unhex('f'))
fmt.Println(Unhex('F'))
Output:

0
9
10
10
15
15

Types

This section is empty.

Jump to

Keyboard shortcuts

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