SoftBank.Note.to_string

You're seeing just the function to_string, go back to SoftBank.Note module for more information.
Link to this function

to_string(note, opts \\ [])

View Source

Specs

to_string(t(), Keyword.t()) :: String.t()

Converts a SoftBank.Note struct to a string representation

The following options are available:

  • separator - default ",", sets the separator for groups of thousands. "1,000"
  • delimeter - default ".", sets the decimal delimeter. "1.23"
  • symbol - default true, sets whether to display the currency symbol or not.
  • symbol_on_right - default false, display the currency symbol on the right of the number, eg: 123.45€
  • symbol_space - default false, add a space between currency symbol and number, eg: € 123,45 or 123.45 €
  • fractional_unit - default true, show the remaining units after the delimeter

Example:

iex> SoftBank.Note.to_string(SoftBank.Note.new(123456, :GBP))
"£1,234.56"
iex> SoftBank.Note.to_string(SoftBank.Note.new(123456, :EUR), separator: ".", delimeter: ",")
"€1.234,56"
iex> SoftBank.Note.to_string(SoftBank.Note.new(123456, :EUR), symbol: false)
"1,234.56"
iex> SoftBank.Note.to_string(SoftBank.Note.new(123456, :EUR), symbol: false, separator: "")
"1234.56"
iex> SoftBank.Note.to_string(SoftBank.Note.new(123456, :EUR), fractional_unit: false)
"€1,234"

It can also be interpolated (It implements the String.Chars protocol) To control the formatting, you can use the above options in your config, more information is in the introduction to SoftBank.Note

Example:

iex> "Total: #{SoftBank.Note.new(100_00, :USD)}"
"Total: $100.00"