istiyakamin / number2word

An simple package to convert numbers to words in Golang. e.g. one thousand twenty four

Home Page:https://pkg.go.dev/github.com/istiyakamin/number2word

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

number2word

A simple package to convert numbers to words in Golang.

test status MIT license Go.Dev reference

go get -u github.com/istiyakamin/number2word

Import Packages

import (
	...
	"github.com/istiyakamin/number2word"
  	...
)

Coded Example

package main

import (
	"fmt"
	"github.com/istiyakamin/number2word"
)

func main(){
	str := number2word.Convert(102547)
	fmt.Println(str)
}

Example

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"

Contributing

In case you notice a bug, please open an issue mentioning the input that has caused an incorrect conversion.

Go to

(watch on pkg.go.dev)[https://pkg.go.dev/github.com/istiyakamin/number2word]

About

An simple package to convert numbers to words in Golang. e.g. one thousand twenty four

https://pkg.go.dev/github.com/istiyakamin/number2word

License:MIT License


Languages

Language:Go 100.0%