Documentation
¶
Index ¶
Constants ¶
const DefaultCurrency = "USD"
DefaultCurrency is the currency code used when none is specified in configuration.
Variables ¶
This section is empty.
Functions ¶
func FormatCurrency ¶
FormatCurrency formats an amount with the appropriate currency symbol. The currencyCode is normalized to uppercase and looked up in the symbol map. If the currency code is empty or unknown, it defaults to USD ($).
Examples:
FormatCurrency(150.00, "USD") returns "$150.00" FormatCurrency(99.99, "EUR") returns "€99.99" FormatCurrency(1234.56, "GBP") returns "£1234.56" FormatCurrency(100.00, "") returns "$100.00" FormatCurrency(100.00, "UNKNOWN") returns "$100.00"
func GetSupportedCurrencies ¶
func GetSupportedCurrencies() []string
GetSupportedCurrencies returns a sorted list of all supported currency codes. This is useful for documentation or validation purposes.
func GetSymbol ¶
GetSymbol returns the display symbol for the given currency code. The currency code is normalized to uppercase before lookup. If the currency code is not found, it returns the code itself.
Examples:
GetSymbol("USD") returns "$"
GetSymbol("eur") returns "€"
GetSymbol("UNKNOWN") returns "UNKNOWN"
func IsSupported ¶
IsSupported returns true if the given currency code is in the supported currencies map. The currency code is normalized to uppercase before checking.
Types ¶
This section is empty.