Converts a number to its English counterpart.
Installation can be achieved via:
go get -u github.com/jtpeller/num2wordsThen, import it:
import "github.com/jtpeller/num2words"You can test the package by running the following command. It will give a short pass or fail result.
go test ./num2words_testAlternatively, for a more verbose output, use:
go test ./num2words_test -vIt also wouldn't hurt to add a -timeout 30 to prevent hanging on a test for too long.
num2words_testnum2words_test.go-- holds all test functions for the package
bignum.go-- holds needed wrappers for the big number package. Utilizes my repo at gobiggo.mod-- manages the modulego.sum-- manages any dependencies (which itself is managed bygo.mod)num2words.go-- implementation for converting numbers to their word representation (e.g. 5 => five)README.md-- the file you're reading