charset

package
v0.0.0-...-c971ce2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 1 Imported by: 4

Documentation

Overview

Package charset provides types for defining and using arbritary charsets.

Index

Constants

This section is empty.

Variables

View Source
var (
	ASCIIUppercase = CharsetArray("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
	ASCIILowercase = CharsetArray("abcdefghijklmnopqrstuvwxyz")
	ASCIINumeric   = CharsetArray("0123456789")
	ASCIISpace     = CharsetArray(" ")
	ASCIISymbol    = CharsetArray("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")
	ASCII          = CharsetArray(string(ASCIIUppercase) + string(ASCIILowercase) + string(ASCIISpace) + string(ASCIINumeric) + string(ASCIISymbol))
	// UnicodePassword is a charset taken from the recommended unicode characters to use in passwords https://msdn.microsoft.com/en-us/library/cc875839.aspx
	UnicodePassword = CharsetArray{} /* 594 elements not displayed */
	// UnicodeEmoji is a charset taken from http://www.unicode.org/Public/UNIDATA/EmojiSources.txt
	UnicodeEmoji = CharsetArray{} /* 722 elements not displayed */
)

Charsets predefined for common usage.

Functions

This section is empty.

Types

type Charset

type Charset interface {
	// At returns the character at the zero based index i.
	At(i int) rune
	// Length returns the number of characters within the charset.
	Length() int
}

Charset is an interface that provides a set of characters.

type CharsetArray

type CharsetArray []rune

CharsetArray is an array of characters.

func (CharsetArray) At

func (c CharsetArray) At(i int) rune

At returns the character at index i.

func (CharsetArray) Length

func (c CharsetArray) Length() int

Length returns the number of characters in the charset.

type CharsetRange

type CharsetRange struct {
	First rune
	Last  rune
}

CharsetRange is a contiguous range of characters starting at First and ending at and including Last.

func (CharsetRange) At

func (c CharsetRange) At(i int) rune

At returns the character at index i.

func (CharsetRange) Length

func (c CharsetRange) Length() int

Length returns the number of characters in the charset.

type Charsets

type Charsets []Charset

Charsets is a charset that is the combination of other charsets.

func (Charsets) At

func (cs Charsets) At(i int) rune

At returns the character at index i, by considering the internal charsets as a contiguous single charset.

func (Charsets) Length

func (cs Charsets) Length() int

Length returns the number of characters in the charset, by summing the lengths of the internal charsets.

Jump to

Keyboard shortcuts

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