Interface NumberFormatOptions


@JsType(isNative=true, namespace="<global>") public interface NumberFormatOptions
Mapping for number format options passed to NumberFormat constructors.

In addition to the actual mappings, this class implements the builder pattern using enums to create the options easily and in a type-safe manner. Some enums are shared with other format option builders of the Intl module and may contain more values than intended for the given method. In that case the allowed values are listed on the method. In all other cases all enum values are applicable.

double number = 123456.789;

console.log(numberFormat("de-DE", numberFormatOptions()
        .style(currency)
        .currency("EUR"))
        .format(number));
// Expected output: "123.456,79 €"

// The Japanese yen doesn't use a minor unit
console.log(numberFormat("ja-JP", numberFormatOptions()
        .style(currency)
        .currency("JPY"))
        .format(number));
// Expected output: "¥123,457"

// Limit to three significant digits
console.log(numberFormat("en-IN", numberFormatOptions()
        .maximumSignificantDigits(3))
        .format(number));
// Expected output: "1,23,000"
See Also: