A simple package to convert numbers to words in Golang.
go get -u github.com/istiyakamin/number2word
Import Packages
import (
...
"github.com/istiyakamin/number2word"
...
)
package main
import (
"fmt"
"github.com/istiyakamin/number2word"
)
func main(){
str := number2word.Convert(102547)
fmt.Println(str)
}
str := number2word.Convert(17) // outputs "seventeen"
str := number2word.Convert(1024) // outputs "one thousand twenty four"
str := number2word.Convert(-123) // outputs "minus one hundred twenty three"
Convert number with " and " between number groups:
str := number2word.ConvertAnd(514) // outputs "five hundred and fourteen"
str := number2word.ConvertAnd(123) // outputs "one hundred and twenty three"
In case you notice a bug, please open an issue mentioning the input that has caused an incorrect conversion.
(watch on pkg.go.dev)[https://pkg.go.dev/github.com/istiyakamin/number2word]