Documentation
¶
Index ¶
- Variables
- func Alphabet(s []byte) []byte
- func AlphabetFromCountOfByte(count map[byte]int) []byte
- func ByteToLower(b byte) byte
- func ByteToUpper(b byte) byte
- func Bytes2Str(b []byte) string
- func CountBytes(seq, letters []byte) int
- func CountOfByte(s []byte) map[byte]int
- func MakeQuerySlice(letters []byte) []byte
- func ReverseByteSlice(s []byte) []byte
- func ReverseByteSliceInplace(s []byte)
- func Split(slice []byte, letters []byte) [][]byte
- func SubSlice(slice []byte, start int, end int) []byte
- func WrapByteSlice(s []byte, width int) []byte
- func WrapByteSlice2(s []byte, width int, buffer *bytes.Buffer) ([]byte, *bytes.Buffer)
- type ByteCoder
- type ByteCount
- type ByteCountList
- type ByteSlice
- type ReversedByteCountList
- type SliceOfByteSlice
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalideLetter means invalid letter ErrInvalideLetter = fmt.Errorf("ByteCoder: invalid letter") // ErrInvalideCode means invalid code ErrInvalideCode = fmt.Errorf("ByteCoder: invalid code") )
Functions ¶
func AlphabetFromCountOfByte ¶
AlphabetFromCountOfByte returns the alphabet of a byte slice from count
func CountBytes ¶
CountBytes counts given ASCII characters in a byte slice
func CountOfByte ¶
CountOfByte returns the count of byte for a byte slice
func MakeQuerySlice ¶
MakeQuerySlice is used to replace map. see: http://blog.shenwei.me/map-is-not-the-fastest-in-go/
func ReverseByteSlice ¶
ReverseByteSlice reverses a byte slice
func ReverseByteSliceInplace ¶
func ReverseByteSliceInplace(s []byte)
ReverseByteSliceInplace reverses a byte slice
func Split ¶ added in v0.3.0
Split splits a byte slice by giveen letters. It's much faster than regexp.Split
Types ¶
type ByteCoder ¶
type ByteCoder struct { Alphabet []byte // contains filtered or unexported fields }
ByteCoder is used to convert betweeen byte and int
func NewByteCoder ¶
NewByteCoder Create a ByteCoder type
type ByteCountList ¶
type ByteCountList []ByteCount
ByteCountList is slice of ByteCount
func SortCountOfByte ¶
func SortCountOfByte(count map[byte]int, reverse bool) ByteCountList
SortCountOfByte sorts count of byte
func (ByteCountList) Len ¶
func (b ByteCountList) Len() int
func (ByteCountList) Less ¶
func (b ByteCountList) Less(i, j int) bool
func (ByteCountList) Swap ¶
func (b ByteCountList) Swap(i, j int)
type ReversedByteCountList ¶
type ReversedByteCountList struct {
ByteCountList
}
ReversedByteCountList is Reversed ByteCountList
func (ReversedByteCountList) Less ¶
func (b ReversedByteCountList) Less(i, j int) bool
Less is different from the Less of ByteCountList
type SliceOfByteSlice ¶
type SliceOfByteSlice [][]byte
SliceOfByteSlice is [][]byte
func (SliceOfByteSlice) Len ¶
func (s SliceOfByteSlice) Len() int
func (SliceOfByteSlice) Less ¶
func (s SliceOfByteSlice) Less(i, j int) bool
func (SliceOfByteSlice) Swap ¶
func (s SliceOfByteSlice) Swap(i, j int)