ILibNumFmt class

Formats numbers, currency amounts, and percentages for a locale.

Configure with ILibNumFmtOptions then call format with any num or String value. The formatter is immutable once created.

Constructors

ILibNumFmt(ILibNumFmtOptions options)
Create a formatter from options. Unspecified options fall back to the locale's defaults.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

constrain(num number) double
Apply the constraints used in the current formatter to the given number. Applies maxFractionDigits, significantDigits, and the rounding mode, and returns the constrained number.
format(dynamic number) String
Format a number according to the settings of this number formatter instance.
getCurrency() String?
Returns the ISO 4217 code for the currency that this formatter formats. Returns null if type is not "currency".
getLocale() String
Return the locale that was used to construct this number formatter object.
getMaxFractionDigits() int
Returns the maximum fraction digits set up in the constructor. -1 means unlimited.
getMinFractionDigits() int
Returns the minimum fraction digits set up in the constructor. -1 means not set.
getRoundingMode() String
Returns the rounding mode set up in the constructor.
getSignificantDigits() int
Returns the significant digits set up in the constructor. -1 means not set.
getStyle() String
Return the style that was used to construct this number formatter object.
getType() String
Return the type of formatter. Valid values are "number", "currency", and "percentage".
getUseNative() bool
Return true if this formatter uses native digits to format the number.
isGroupingUsed() bool
Returns true if this formatter groups together digits in the integral portion of a number.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited