Documentation ¶
Index ¶
- Variables
- func AppendInt(dst []byte, i int64) []byte
- func AppendSerialInt(dst []byte, i int64) []byte
- func AppendSerialUint(dst []byte, u uint64) []byte
- func AppendUint(dst []byte, u uint64) []byte
- func FormatBigInt(i *big.Int) string
- func FormatInt(i int64) string
- func FormatSerialInt(i int64) string
- func FormatSerialUint(u uint64) string
- func FormatUint(u uint64) string
- func FromDaiji() *strings.Replacer
- func ParseBigInt(s string) (*big.Int, error)
- func ParseInt(s string) (int64, error)
- func ParseSerialInt(s string) (int64, error)
- func ParseSerialUint(s string) (uint64, error)
- func ParseUint(s string) (uint64, error)
- func ToDaiji() *strings.Replacer
- func ValueOf(r rune) (value uint64, ok bool)
- type SearchBigIntResult
- type SearchResult
- type UnexpectedRuneError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmpty is returned if a function does not allow empty strings as a parameter. ErrEmpty = errors.New("empty string") // ErrEOF is returned if a function expects a rune and detects an EOF instead. ErrEOF = errors.New("unexpected eof") // ErrOverflow is returned if the number is too big for the function. ErrOverflow = errors.New("number overflows datatype") // ErrEncoding ist returned if a function recognizes an invalid UTF-8 encoding. ErrEncoding = errors.New("invalid utf-8 encoding") // ErrInvalidSequence is returned if a string contains an invalid sequence of digits. // Examples: "一一" or "十百" ErrInvalidSequence = errors.New("invalid sequence of digits") // ErrUnexpectedRune is returned if a functions finds a rune that it does not expect. ErrUnexpectedRune = errors.New("unexpected rune") )
Functions ¶
func AppendSerialInt ¶ added in v0.6.0
func AppendSerialUint ¶ added in v0.6.0
func AppendUint ¶ added in v0.5.0
func FormatBigInt ¶
FormatBigInt returns the given big integer as a string of Japanese numerals. Supports only numbers |i| < 10^72.
func FormatSerialInt ¶ added in v0.6.0
FormatSerialInt returns the given integer as a string of Japanese numerals where the decimal digits 0 to 9 are replaced by the kanjis 〇 to 九.
func FormatSerialUint ¶ added in v0.6.0
FormatSerialInt returns the given unsigned integer as a string of Japanese numerals where the decimal digits 0 to 9 are replaced by the kanjis 〇 to 九.
func FormatUint ¶
FormatUint returns the given unsigned integer as a string of Japanese numerals.
func ParseBigInt ¶ added in v0.2.0
ParseBigInt returns the integer represented by the given japanese numerals.
func ParseSerialInt ¶ added in v0.6.0
ParseSerialInt returns the signed integer represented by the given japanese numerals.
func ParseSerialUint ¶ added in v0.6.0
ParseSerialUint returns the unsigned integer represented by the given japanese numerals.
Types ¶
type SearchBigIntResult ¶ added in v0.4.0
SearchBigIntResult is single match in a text that may be a japanese numeral.
func FindBigInt ¶ added in v0.4.0
func FindBigInt(s string) []*SearchBigIntResult
FindBigInt returns an array of all potential japanese numerals in the given string.
type SearchResult ¶ added in v0.4.0
SearchResult is single match in a text that may be a japanese numeral.
func Find ¶ added in v0.4.0
func Find(s string) []*SearchResult
Find returns an array of all potential japanese numerals in the given string.
type UnexpectedRuneError ¶
type UnexpectedRuneError struct {
Actual, Expected rune
}
UnexpectedRuneError is returned if a functions finds a rune that it does not expect.
func (*UnexpectedRuneError) Error ¶
func (e *UnexpectedRuneError) Error() string
func (*UnexpectedRuneError) Is ¶ added in v0.6.0
func (e *UnexpectedRuneError) Is(err error) bool