Skip to content

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

License

Notifications You must be signed in to change notification settings

istiyakamin/number2word

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages