descriptor

package
v2.10.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package descriptor parses a RNBF rule descriptor.

See: https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classicu_1_1RuleBasedNumberFormat.html#details

Index

Constants

View Source
const (
	TypeDefault = Type(iota)
	TypeBaseValue
	TypeBaseValueAndRadix
	TypeNegativeNumber
	TypeProperFraction
	TypeImproperFraction
	TypeInfinity
	TypeNaN
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Descriptor

type Descriptor struct {
	Type    Type
	Base    int64
	Divisor int64
}

func Parse

func Parse(s string) Descriptor

Parse parses a rule descriptor in the following format, or panics:

  • bv and rad are the names of tokens formatted as decimal numbers expressed using ASCII digits with spaces, period, and commas ignored.
  • bv specifies the rule's base value. The rule's divisor is the highest power of 10 less than or equal to the base value.
  • bv/rad: The rule's divisor is the highest power of rad less than or equal to the base value.
  • -x: The rule is a negative-number rule.
  • x.x: The rule is an improper fraction rule.
  • 0.x: The rule is a proper fraction rule.
  • x.0: The rule is a default rule.
  • Inf: The rule for infinity.
  • NaN: The rule for an IEEE 754 NaN (not a number).

type Type

type Type uint8

Jump to

Keyboard shortcuts

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