Formats a number as currency using locale rules.

formatCurrency(value: number, locale: string, currency: string, currencyCode?: string, digitsInfo?: string): string

value number

The number to format.

locale string

A locale code for the locale format rules to use.

currency string

A string containing the currency symbol or its name, such as "$" or "Canadian Dollar". Used in output string, but does not affect the operation of the function.

currencyCode string

The ISO 4217 currency code, such as USD for the US dollar and EUR for the euro. Used to determine the number of digits in the decimal part.

Optional. Default is undefined.

digitsInfo string

Decimal representation options, specified by a string in the following format: {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}. See DecimalPipe for more details.

Optional. Default is undefined.


string: The formatted currency value.

See also

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.