填寫這份《一分鐘調查》,幫我們(開發組)做得更好!去填寫Home

getLocaleNumberFormat

檢索給定語言環境下的數字格式。

Retrieves a number format for a given locale.

檢視"說明"...

      
      getLocaleNumberFormat(locale: string, type: NumberFormatStyle): string
    
引數
locale string

用於要使用的語言環境格式規則的語言環境程式碼。

A locale code for the locale format rules to use.

type NumberFormatStyle

要格式化的數值型別(例如 DecimalCurrency)。

The type of numeric value to be formatted (such as Decimal or Currency.)

返回值

本地化的格式字串。

string: The localized format string.

參見

說明

數字會以類似 #,###.00 的模式進行格式化。例如,模式 #,###.00 用於格式化數字 12345.678 時可能的結果是 “12'345,678”。如果你的語言的分組分隔符是撇號,而十進位制分隔符是逗號,就會是這樣的。

Numbers are formatted using patterns, like #,###.00. For example, the pattern #,###.00 when used to format the number 12345.678 could result in "12'345,678". That would happen if the grouping separator for your language is an apostrophe, and the decimal separator is a comma.

重要:. , 0 #(以及以下的)字元是特殊的佔位符,它們代表數字分隔符等,而不是真實的字元。你絕不能“翻譯”這些佔位符。例如,不要把 . 修改成 ,,雖然在你的語言中小數點分隔符是寫成逗號的。該符號會被其本地化等價物替換,也就是適合你的語言的 NumberSymbol

Important: The characters . , 0 # (and others below) are special placeholders that stand for the decimal separator, and so on, and are NOT real characters. You must NOT "translate" the placeholders. For example, don't change . to , even though in your language the decimal point is written with a comma. The symbols should be replaced by the local equivalents, using the appropriate NumberSymbol for your language.

以下是數字模式中使用的特殊字元:

Here are the special characters used in number patterns:

符號

Symbol

含義

Meaning

.

自動替換為用作小數點的字元。

Replaced automatically by the character used for the decimal point.

,

.

替換為(千)“分組”分隔符。

Replaced by the "grouping" (thousands) separator.

0

替換為一個數字(如果沒有足夠的數字,則為零)。

Replaced by a digit (or zero if there aren't enough digits).

#

用數字代替(如果數字不足,則不進行任何替換)。

Replaced by a digit (or nothing if there aren't enough).

¤

替換為貨幣符號,例如 $ 或 USD。

Replaced by a currency symbol, such as $ or USD.

%

標記百分比格式。%符號可能會更改位置,但必須保留。

Marks a percent format. The % symbol may change position, but must be retained.

E

標記科學計數法格式。 E 符號可能會改變位置,但必須保留。

Marks a scientific format. The E symbol may change position, but must be retained.

'

表示文字字面量的特殊字元,用 ASCII 單引號引起來。

Special characters used as literal characters are quoted with ASCII single quotes.