Documentation ¶
Index ¶
- Variables
- func ConvertToStringWithDecimal(num int, fraction int) string
- func DisplayFull(num int, alpha string) (string, error)
- func DisplayNoSymbol(num int, alpha string) (string, error)
- func DisplayWithAlpha(num int, alpha string) (string, error)
- func DisplayWithDecimal(num int, alpha string) (string, error)
- func FloatToInt(amt float64, fraction int) int
- func FormatCurrency(num int, ISO Currency) string
- func GetAlphaFromISONumeric(num string) (string, error)
- func GetCardType(cardnum string) (string, error)
- func GetISOCodeFromNumeric(num string) (string, error)
- func InsertDelimiter(str string, group int, del string) string
- func IntToFloat(amt int, fraction int) float64
- func IsNegative(num int) bool
- func MaskACHAccount(accountNumber string) (string, error)
- func MaskCard(cardnumber string) (string, string, string, error)
- func PercentageFromFloat(amt float64, percentage float64, fraction int) float64
- func PercentageFromInt(amt int, percentage float64, fraction int) float64
- func StringToInt(num string, alpha string) (int, error)
- func SwapSymbolWithAlpha(str string, sym string, alpha string) string
- func ValidLuhn(s string) bool
- type Currency
Constants ¶
This section is empty.
Variables ¶
var ( ErrCardLength = errors.New("card length should be > 10") ErrACHLength = errors.New("account length should be > 4") ErrUnknownCardType = errors.New("unknown card type") )
var ( AMEXCardFormatRegex = regexp.MustCompile(amexCardFormatString) VISACardFormatRegex = regexp.MustCompile(visaCardFormatString) MasterCardFormatRegex = regexp.MustCompile(mastercardCardFormatString) DISCOVERCardFormatRegex = regexp.MustCompile(discoverCardFormatString) JCBCardFormatRegex = regexp.MustCompile(jcbCardFormatString) DINERSCardFormatRegex = regexp.MustCompile(dinersClubInternationalFormatString) )
var CurrencyList = map[string]Currency{}/* 157 elements not displayed */
CurrencyList - complete list of supported currencies
var ErrorInvalidISO = errors.New("Invalid ISO Code")
ErrorInvalidISO : returns an error for an invalid ISO code
var ErrorInvalidISOFractionMatch = errors.New("Invalid ISO Fraction Match")
ErrorInvalidISOFractionMatch : returns an error if fraction does not match ISO fraction
var ErrorInvalidStringFormat = errors.New("Invalid String Format")
ErrorInvalidStringFormat : returns an error if trying to convert an invalid string value
var ErrorUnableToFormatCurrency = errors.New("Unable To Format Currency")
ErrorUnableToFormatCurrency : returns an error for invalid currency formatting
var ErrorUnableToFormatCurrencyFromString = errors.New("Unable To Format Currency From String")
ErrorUnableToFormatCurrencyFromString : returns an error for invalid formatting from a string
Functions ¶
func ConvertToStringWithDecimal ¶
ConvertToStringWithDecimal : returns the uint as a stringified float
func DisplayFull ¶
DisplayFull : returns a string with full currency formatting... "num" being the amount, "alpha" being the ISO three digit alphabetic code.
func DisplayNoSymbol ¶
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 ¶
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 ¶
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 FloatToInt ¶ added in v0.1.8
FloatToInt will take in a float and based upon fraction will output the int version
func FormatCurrency ¶
FormatCurrency : returns basic currency formatting
func GetAlphaFromISONumeric ¶
GetAlphaFromISONumeric : returns a formatted ISO alpha code from the ISO numeric counterpart
func GetCardType ¶ added in v0.2.0
GetCardType Accepts a string containing a credit card number and validates it against some regexes to return the card type.
func GetISOCodeFromNumeric ¶
GetISOCodeFromNumeric : returns a formatted ISO numeric code or an error if the ISO is not found
func InsertDelimiter ¶
InsertDelimiter : returns a new string with delimiter formatting
func IntToFloat ¶ added in v0.1.8
IntToFloat will take in a int and based upon fraction will output the float version
func IsNegative ¶ added in v0.1.6
IsNegative : returns a bool based on whether the int is negative or positive
func MaskACHAccount ¶ added in v0.2.0
MaskACHAccount takes in an account number and returns masked
func MaskCard ¶ added in v0.2.0
MaskCard takes in a card number and returns firstsix, lastfour, masked
func PercentageFromFloat ¶ added in v0.1.8
PercentageFromFloat will give you a percentage to the exact precision that you want based on fraction
func PercentageFromInt ¶ added in v0.1.8
PercentageFromInt will give you a percentage to the exact precision that you want based on fraction
func StringToInt ¶ added in v0.1.3
StringToInt : returns a int from a string value
func SwapSymbolWithAlpha ¶
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 ¶
GetISOFromAlpha : returns a formatted ISO alpha code or an error if the ISO is not found
func ListCurrencies ¶
ListCurrencies : returns a list of currencies
func TopCurrencies ¶
TopCurrencies returns the list of top currencies based upon usage