digit

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadDigit = errors.New("bad digit")
)

Functions

This section is empty.

Types

type Digit

type Digit uint8

Digit is a type for digit

const (
	// Digit0 - 0
	Digit0 Digit = iota
	// Digit1 - 1
	Digit1
	// Digit2 - 2
	Digit2
	// Digit3 - 3
	Digit3
	// Digit4 - 4
	Digit4
	// Digit5 - 5
	Digit5
	// Digit6 - 6
	Digit6
	// Digit7 - 7
	Digit7
	// Digit8 - 8
	Digit8
	// Digit9 - 9
	Digit9
	// DigitUnknown unknown digit
	DigitUnknown
)

func ParseRune

func ParseRune(s rune) Digit

ParseRune parses rune and return Digit or DigitUnknown when rune is an invalid digit.

func (Digit) IsNotZero

func (d Digit) IsNotZero() bool

IsNotZero returns true when Digit is not zero

func (Digit) IsZero

func (d Digit) IsZero() bool

IsZero return true when Digit is 0, returns false otherwise

func (Digit) String

func (d Digit) String() string

String returns string for Digit, when Digit is invalid returns an empty string.

func (Digit) Validate

func (d Digit) Validate() error

Validate validates Digit, returns ErrBadDigit if Digit is invalid.

Jump to

Keyboard shortcuts

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