Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTooShort = fmt.Errorf("alphabet must be at least %d characters", alphaMinChars) ErrDuplicateChars = errors.New("alphabet contains duplicated characters") )
Functions ¶
This section is empty.
Types ¶
type Alphabet ¶
type Alphabet struct {
// contains filtered or unexported fields
}
Example ¶
alpha := NewAlphabet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789").Rotate(500) // alpha = alpha.Slice(1, 10) for i := range alpha.Len() { fmt.Printf("%02d = %s\n", i, string(alpha.At(i))) } fmt.Println("found 'd' at:", alpha.IndexByte('d'))
Output: TODO
func NewAlphabet ¶
newAlphabet creates a new Alphabet without any initial rotation.
func (Alphabet) IndexByte ¶
IndexByte returns the index of the given byte in the rotated and sliced alphabet, or -1 if not found.
Click to show internal directories.
Click to hide internal directories.