Documentation ¶
Index ¶
Constants ¶
View Source
const ( USDAbbr = "USD" USDSymbol = "$" UnitsBillionsDesc = "billions" UnitsBillionsInt = 1000000000 UnitsMillionsDesc = "millions" UnitsMillionsInt = 1000000 UnitsThousandsDesc = "thousands" UnitsThousandsInt = 1000 )
Variables ¶
View Source
var ( ErrUnknownCurrencyPrefix = errors.New("unknown currency prefix") ErrUnknownCurrencySuffix = errors.New("unknown currency suffix") )
View Source
var SymbolMap = map[string]string{
"AFN": "؋",
"ARS": "$",
"AWG": "ƒ",
"BRL": "R$",
"CAD": "$",
"CLP": "$",
"CNY": "¥",
"CRC": "₡",
"CUP": "₱",
"EGP": "£",
"EUR": "€",
"FKP": "£",
"GBP": "£",
"ILS": "₪",
"IRR": "﷼",
"JPY": "¥",
"KHR": "៛",
"KLR": "₨",
"KPW": "₩",
"KRW": "₩",
"MNT": "₮",
"NGN": "₦",
"NOK": "kr",
"PHP": "₱",
"PLN": "zł",
"RUB": "₽",
"SAR": "﷼",
"THB": "฿",
"UAH": "₴",
"USD": "$",
"UZS": "лв",
"VND": "₫",
"YER": "﷼"}
Functions ¶
func ParseCurrency ¶ added in v0.39.0
func ParseCurrency(opts *ParseCurrencyOpts, s string) (string, float64, error)
func SymbolPrefix ¶
Types ¶
type Formatter ¶
type Formatter struct { Accounting accounting.Accounting SymbolPrefix string DefaultISOCode string PrefixCodeDefault bool PrefixCodeNonDefault bool }
func NewFormatter ¶
func (*Formatter) FormatMoney ¶
type ParseCurrencyOpts ¶ added in v0.39.0
type ParseCurrencyOpts struct { Comma string Decimal string BillionsAbbr []string MillionsAbbr []string ThousandsAbbr []string }
func NewParseCurrencyOpts ¶ added in v0.39.0
func NewParseCurrencyOpts() ParseCurrencyOpts
Click to show internal directories.
Click to hide internal directories.