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_code, backend, options \\ [])

View Source

Specs

currency_for_code(code(), Cldr.backend(), Keyword.t()) ::
  {:ok, t()} | {:error, {module(), String.t()}}

Returns the currency metadata for the requested currency code.

Arguments

  • currency_code is a binary or atom representation of an ISO 4217 currency code.

  • backend is any module that includes use Cldr and therefore is a Cldr backend module

  • options is a Keyword list of options.

Options

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
}}