Magik.Formatter (Magik v0.10.0) View Source

Provides functions to format value to string

Link to this section Summary

Functions

Format currency value to thousand separated string

Format number to thousand seperated string

Link to this section Functions

Link to this function

format_currency(number, opts \\ [])

View Source

Format currency value to thousand separated string

Parameters

  • number: integer number
  • opts: list of format options
    • thousand_separator: thousand separator character. Default is ,
    • currency: currency character. Default is "đ"

Example

iex> Magik.Formatter.format_currency("1232321", thousand_separator: ".", currency: "$") 1.232.321$

Link to this function

format_thousand(number, separator \\ ".")

View Source

Format number to thousand seperated string

Parameters

  • number: integer number
  • separator: thousand separator character. Default is .

Example

iex> Magik.Formatter.format_thousand("1232321", ".")
1.232.321