dough

package module
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 6 Imported by: 0

README

Dough

Dough

"Roll Out" your golang currency issues with Dough.

Build Status

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrencyList = map[string]Currency{}/* 157 elements not displayed */

CurrencyList - complete list of supported currencies

View Source
var ErrorInvalidISO = errors.New("Invalid ISO Code")

ErrorInvalidISO : returns an error for an invalid ISO code

View Source
var ErrorInvalidStringFormat = errors.New("Unable To Convert Invalid String Format")

ErrorInvalidStringFormat : returns an error if trying to convert an invalid string value

View Source
var ErrorUnableToFormatCurrency = errors.New("Unable To Format Currency")

ErrorUnableToFormatCurrency : returns an error for invalid currency formatting

View Source
var ErrorUnableToFormatCurrencyFromString = errors.New("Unable To Format Currency From String")

ErrorUnableToFormatCurrencyFromString : returns an error for invalid formatting from a string

Functions

func ConvertToStringWithDecimal

func ConvertToStringWithDecimal(num int, fraction int) string

ConvertToStringWithDecimal : returns the uint as a stringified float

func DisplayFull

func DisplayFull(num int, alpha string) (string, error)

DisplayFull : returns a string with full currency formatting... "num" being the amount, "alpha" being the ISO three digit alphabetic code.

func DisplayNoSymbol

func DisplayNoSymbol(num int, alpha string) (string, error)

DisplayNoSymbol : returns a string with full currency formatting minus the ISO symbol... "num" being the amount, "alpha" being the ISO three digit alphabetic code.

func DisplayWithAlpha

func DisplayWithAlpha(num int, alpha string) (string, error)

DisplayWithAlpha : returns a string with full currency formatting with the symbol replaced by the ISO three digit alphabetic code... "num" being the amount, "alpha" being the ISO three digit alphabetic code.

func DisplayWithDecimal

func DisplayWithDecimal(num int, alpha string) (string, error)

DisplayWithDecimal : returns a string with all currency formatting removed except decimal places... "num" being the amount, "alpha" being the ISO three digit alphabetic code.

func FormatCurrency

func FormatCurrency(num int, ISO Currency) string

FormatCurrency : returns basic currency formatting

func GetAlphaFromISONumeric

func GetAlphaFromISONumeric(num string) (string, error)

GetAlphaFromISONumeric : returns a formatted ISO alpha code from the ISO numeric counterpart

func GetISOCodeFromNumeric

func GetISOCodeFromNumeric(num string) (string, error)

GetISOCodeFromNumeric : returns a formatted ISO numeric code or an error if the ISO is not found

func InsertDelimiter

func InsertDelimiter(str string, group int, del string) string

InsertDelimiter : returns a new string with delimiter formatting

func IsNegative added in v0.1.6

func IsNegative(num int) bool

IsNegative : returns a bool based on whether the int is negative or positive

func RemoveDecimal

func RemoveDecimal(str string, dec string) string

RemoveDecimal : returns a string with the decimal removed

func RemoveDelimiter

func RemoveDelimiter(str string, del string) string

RemoveDelimiter : returns a string with the delimiter removed

func RemoveSymbol

func RemoveSymbol(str string, sym string) string

RemoveSymbol : returns a string with the symbol removed

func ReverseString

func ReverseString(str string) string

ReverseString : returns a reversed string for delimiter formatting

func StringToInt added in v0.1.3

func StringToInt(num string, alpha string) (int, error)

StringToInt : returns a int from a string value

func SwapSymbolWithAlpha

func SwapSymbolWithAlpha(str string, sym string, alpha string) string

SwapSymbolWithAlpha : returns a string with the ISO alpha code instead of symbol

Types

type Currency

type Currency struct {
	Unit                string
	Alpha               string
	Numeric             string
	Symbol              string
	Fraction            int
	Decimal             string
	Grouping            int
	Delimiter           string
	SymbolPositionFront bool
}

Currency - struct containing currency variables

func GetISOFromAlpha

func GetISOFromAlpha(alpha string) (Currency, error)

GetISOFromAlpha : returns a formatted ISO alpha code or an error if the ISO is not found

func ListCurrencies

func ListCurrencies(list []string) ([]Currency, error)

ListCurrencies : returns a list of currencies

func TopCurrencies

func TopCurrencies() ([]Currency, error)

TopCurrencies returns the list of top currencies based upon usage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL