Money.to_string-exclamation-mark

You're seeing just the function to_string-exclamation-mark, go back to Money module for more information.
Link to this function

to_string!(money, options \\ [])

View Source

Specs

to_string!(t(), Keyword.t()) :: String.t() | no_return()

Returns a formatted string representation of a Money.t or raises if there is an error.

Formatting is performed according to the rules defined by CLDR. See Cldr.Number.to_string!/2 for formatting options. The default is to format as a currency which applies the appropriate rounding and fractional digits for the currency.

Arguments

  • money is any valid Money.t type returned by Money.new/2

  • options is a keyword list of options

Options

  • :backend is any CLDR backend module. The default is Money.default_backend().

  • Any other options are passed to Cldr.Number.to_string/3

Examples

iex> Money.to_string! Money.new(:USD, 1234)
"$1,234.00"

iex> Money.to_string! Money.new(:JPY, 1234)
"¥1,234"

iex> Money.to_string! Money.new(:THB, 1234)
"THB 1,234.00"

iex> Money.to_string! Money.new(:USD, 1234), format: :long
"1,234 US dollars"