currency_formatter v0.3.0 CurrencyFormatter
This module takes care of formatting a number to a currency. You can also request a map containing all the formatting settings for a currency.
Summary
Functions
Formats a number to currency
Returns a map containing the full list of currencies
Returns a map with formatting settings for a currency
Functions
Formats a number to currency
examples
iex> CurrencyFormatter.format(123456)
"$1,234.56"
iex> CurrencyFormatter.format(654321, :eur)
"€6.543,21"
iex> CurrencyFormatter.format(654321, "AUD")
"A$6,543.21"
Specs
get_currencies :: Map.t
Returns a map containing the full list of currencies
examples
iex> currencies = CurrencyFormatter.get_currencies()
iex> Enum.count(currencies)
165
iex> currencies["usd"]
%{"alternate_symbols" => ["US$"], "decimal_mark" => ".", "html_entity" => "$",
"iso_code" => "USD", "iso_numeric" => "840", "name" => "United States Dollar",
"priority" => 1, "smallest_denomination" => 1, "subunit" => "Cent",
"subunit_to_unit" => 100, "symbol" => "$", "symbol_first" => true,
"thousands_separator" => ","}
Returns a map with formatting settings for a currency
examples
iex> CurrencyFormatter.instructions(:EUR)
%{"alternate_symbols" => [], "decimal_mark" => ",", "html_entity" => "€",
"iso_code" => "EUR", "iso_numeric" => "978", "name" => "Euro", "priority" => 2,
"smallest_denomination" => 1, "subunit" => "Cent", "subunit_to_unit" => 100,
"symbol" => "€", "symbol_first" => true, "thousands_separator" => "."}