Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 1.52 KB

README.md

File metadata and controls

58 lines (42 loc) · 1.52 KB

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]