Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 649 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 649 Bytes

currency

This package generates structs containing all the up-to-date ISO4217 currency codes and minor units, along with a very simple validator.

Data is graciously provided by:

Usage:

package main

func main() {
	// Validation of codes.
	ok := currency.Valid("ABC")
	if !ok {
		// whatever you need.
	}

	// easy to get the values
	fmt.Println(currency.USD.Code())
	// Output: USD

	fmt.Println(currency.USD.MinorUnit())
	// Output: 2
}