NumberFormat defines an interface for parsing numbers in a specific format (such as a decimal number in a specific locale, with support for a digit separator such as commas and a decimal point). Numbers are assumed to be in the normal base (e.g. base 10 for decimal) for that locale.
Errors are either nil, strconv.ErrSyntax or strconv.ErrRange
type NumberFormat interface { ParseInt(string) (int64, error) ParseFloat(string) (float64, error) // AcceptInt parses as much of an integer as possible. The second return // value is the number of bytes (not runes) successfully parsed. The error // value is always either nil or strconv.ErrRange. AcceptInt(string) (int64, int, error) // AcceptFloat parses as much of a float as possible. The second return // value is the number of bytes (not runes) successfully parsed. The error // value is always either nil or strconv.ErrRange. AcceptFloat(string) (float64, int, error) }
func NewDecimalFormat(tag language.Tag) NumberFormat
NewDecimalFormat constructs, for a given locale, a NumberFormat that defines how a decimal (base-10) number should be parsed. Note that the behaviour is undefined for locales that have non-base-10 number systems.