np

package
v2.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package np provides a way to query the Numeric Properties of a Unicode code point. This allows, for example, parsing the value of digits and numerals in other languages.

Index

Constants

View Source
const (
	None    = 0
	Decimal = 1 // decimal-radix numeral e.g. 0-9
	Digit   = 2 // typographic context e.g. superscript
	Numeric = 3 // non-decimal e.g. Roman numerals
)

Variables

This section is empty.

Functions

func Get

func Get(x rune) (Type, Fraction)

Get returns, for the given codepoint, its Type and Value. If not found, Type is None.

Types

type Fraction

type Fraction struct {
	Numerator   int64
	Denominator int64
}

Fraction is some (Numerator/Denominator)

type Type

type Type int

Type returns the type of a numeral.

  • Decimal is a numeral in a decimal-radix number system, such as the ASCII digits 0-9, Devanagari digits, Arabic digits, etc.
  • Digit is like Decimal, but in some typographic context, e.g. superscript, a number in a circle, etc.
  • Numeric is a numeral that has a value, but does not appear in a decimal system. For example, fractions, Tamil numbers, or Roman numerals.

Jump to

Keyboard shortcuts

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