Documentation ¶
Overview ¶
Package byteutil provides various operations on bytes and byte strings.
Index ¶
- func ByteToLower(b byte) byte
- func ByteToUpper(b byte) byte
- func IndexAny(s, chars string) int
- func IndexAnyTable(s string, t *[256]bool) int
- func IsAlphaNum(b byte) bool
- func IsDigit(b byte) bool
- func IsHexDigit(b byte) bool
- func IsLetter(b byte) bool
- func IsLowercaseLetter(b byte) bool
- func IsUppercaseLetter(b byte) bool
- func ToLower(s string) string
- func ToUpper(s string) string
- func Unhex(d byte) byte
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteToLower ¶
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 ¶
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 IndexAnyTable ¶
Example ¶
var t [256]bool t['z'], t['y'], t['x'] = true, true, true fmt.Println(IndexAnyTable("abcdefghijklmnopqrstuvwxyz", &t))
Output: 23
func IsAlphaNum ¶
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 ¶
Example ¶
fmt.Println(IsDigit('0')) fmt.Println(IsDigit('9')) fmt.Println(IsDigit('a'))
Output: true true false
func IsHexDigit ¶
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 ¶
Example ¶
fmt.Println(IsLetter('a')) fmt.Println(IsLetter('Z')) fmt.Println(IsLetter('0'))
Output: true true false
func IsLowercaseLetter ¶
Example ¶
fmt.Println(IsLowercaseLetter('a')) fmt.Println(IsLowercaseLetter('z')) fmt.Println(IsLowercaseLetter('A'))
Output: true true false
func IsUppercaseLetter ¶
Example ¶
fmt.Println(IsUppercaseLetter('A')) fmt.Println(IsUppercaseLetter('Z')) fmt.Println(IsUppercaseLetter('a'))
Output: true true false
func ToLower ¶
Example ¶
fmt.Println(ToLower(".012345abcdefABCDEFабвгд"))
Output: .012345abcdefabcdefабвгд
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.