Przejdź do głównej zawartości

Function: getCurrencySymbol()

getCurrencySymbol(code, locale?): string

Get the currency symbol for an ISO 4217 code in the requested locale. Derived from Intl.NumberFormat.formatToParts() — every currency known to the runtime is supported, with the locale-correct symbol.

Parameters

code

string

locale?

string

Returns

string

Example

getCurrencySymbol('PLN', 'pl-PL')  // => "zł"
getCurrencySymbol('PLN', 'en-US') // => "PLN" (en-US has no narrow symbol for PLN)
getCurrencySymbol('EUR', 'de-DE') // => "€"
getCurrencySymbol('USD') // depends on the runtime locale