我正在嘗試使用 sap.ui.core.format.NumberFormat作爲貨幣格式化控制值Text。但是,當數字被格式化時,貨幣符號不會被顯示。NumberFormat不顯示貨幣代碼
var value = 1000000;
var fmtOptions = {
currencyCode: true,
showMeasure: true,
maxFractionDigits: 1
};
var locale = new sap.ui.core.Locale("en-US");
var currencyFormat = sap.ui.core.format.NumberFormat.getCurrencyInstance(fmtOptions, locale)
currencyFormat.format(value)
返回值是:
「1,000,000.00」
- 我怎樣才能在號碼前顯示 「$」?
- 另外,有沒有一種方法可以傳遞我想要顯示的貨幣代碼 'INR'?
謝謝。很好的作品 – Deepak