JavaScript

Intl.NumberFormat オブジェクト


編集:2023.01.11 by T.A.

[Edge]。→

言語を考慮した数値の書式化を可能にするオブジェクト。

コンストラクター
new Intl.NumberFormat([locales[, options]])
新しい Intl.NumberFormat オブジェクトを生成して返します。
静的メソッド
Intl.NumberFormat.supportedLocalesOf(locales[, options])
数値の書式化で、指定されたロケールのサブ タグで対応する物を表す文字列を配列で返します。
インスタンス メソッド
Intl.NumberFormat.format(number)
Intl.NumberFormat で指定数値を初期化して文字列で返します。
Intl.NumberFormat.formatToParts([number])
Intl.NumberFormat で指定数値を書式化して、その部分毎のデータ オブジェクトの配列を返します。
Intl.NumberFormat.resolvedOptions()
Intl.NumberFormat で、数値の書式化に関与するプロパティを持つ新しいオブジェクトを返します。
DA=new Intl.NumberFormat('ja');  //日本語。
D=DA.format(123.5);  //=[string]:123.5
DA=new Intl.NumberFormat('ja-u-nu-fullwide');  //日本語。
D=DA.format(123.5);  //=[string]:123.5

テスト