Cldr.Currency.currency_for_code
You're seeing just the function
currency_for_code
, go back to Cldr.Currency module for more information.
Link to this function
currency_for_code(currency_or_currency_code, backend, options \\ [])
View SourceSpecs
currency_for_code(code() | t(), Cldr.backend(), Keyword.t()) :: {:ok, t()} | {:error, {module(), String.t()}}
Returns the currency metadata for the requested currency code.
Arguments
currency_or_currency_code
is abinary
oratom
representation of an ISO 4217 currency code, or a%Cldr.Currency{}
struct.backend
is any module that includesuse Cldr
and therefore is aCldr
backend moduleoptions
is aKeyword
list of options.
Options
:locale
is any valid locale name returned byCldr.known_locale_names/1
or aCldr.LanguageTag
struct returned byCldr.Locale.new!/2
Examples
iex> Cldr.Currency.currency_for_code("AUD", MyApp.Cldr)
{:ok,
%Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "AUD",
count: %{one: "Australian dollar", other: "Australian dollars"},
digits: 2,
iso_digits: 2,
name: "Australian Dollar",
narrow_symbol: "$",
rounding: 0,
symbol: "A$",
tender: true
}}
iex> Cldr.Currency.currency_for_code("THB", MyApp.Cldr)
{:ok,
%Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "THB",
count: %{one: "Thai baht", other: "Thai baht"},
digits: 2,
iso_digits: 2,
name: "Thai Baht",
narrow_symbol: "฿",
rounding: 0,
symbol: "THB",
tender: true
}}