Documentation
¶
Overview ¶
package currency is a library to deal with money and currency representation.
Usage
Format(10, "USD") // "$10.00" Format(10, "EUR") // "€10.00" Format(10, "USD", WithCents(false)) // "$10" Format(10, "USD", WithCurrency(true)) // "$10.00 USD" Format(10, "USD", WithSymbol(false) // "10.00" Format(10, "USD", WithSymbolSpace(true) // "$ 10.00" Format(1000, "USD") // "$1,000.00" Format(1000, "USD", WithThousandsSeparator(false) // "$1000.00"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
WithCents bool
WithCurrency bool
WithSymbol bool
WithSymbolSpace bool
WithThousandsSeparator bool
}
Options {
WithCents: true,
WithCurrency: false,
WithSymbol: true,
WithSymbolSpace: false,
WithThousandsSeparator: true,
}
type OptionsFn ¶
type OptionsFn func(*Options)
OptionsFn function parameter
func WithCurrency ¶
WithCurrency Should add currency text or not Default false
func WithSymbol ¶
WithSymbol Should display symbol or not Default true
func WithSymbolSpace ¶
WithSymbolSpace Should add space between symbol or not Default false
func WithThousandsSeparator ¶
WithThousandsSeparator Should use thousand separator or not Default true
Click to show internal directories.
Click to hide internal directories.