Numbers to words converter in Go
Go to file
2024-02-26 22:39:07 -08:00
.travis.yml Fix Go version in travis.yml 2017-09-04 22:57:50 +02:00
en.go add Spanish localization 2024-02-26 21:47:00 -08:00
es.go add Spanish localization 2024-02-26 21:47:00 -08:00
go.mod update go.mod again 2024-02-26 22:17:27 -08:00
go.sum add empty go.sum in an attempt to tell go we dont need any external dependencies 2021-02-23 16:34:58 -08:00
lang.go add Spanish localization 2024-02-26 21:47:00 -08:00
LICENSE Initial commit 2013-11-30 10:31:20 -08:00
locale.go add Spanish localization 2024-02-26 21:47:00 -08:00
num2words.go minor cleanup 2024-02-26 22:39:07 -08:00
num2words_test.go add Spanish localization 2024-02-26 21:47:00 -08:00
README.md update readme 2024-02-26 22:05:04 -08:00

num2words

num2words - Numbers to words converter in Go (Golang)

Usage

First, go get package num2words go get github.com/celediel/num2words@localized

Then, import package num2words

import "github.com/celediel/num2words"

Convert number

  str := num2words.Convert(17, "en") // outputs "seventeen"
  str := num2words.Convert(17, "es") // outputs "diecisiete"
  ...
  str := num2words.Convert(1024, "en") // outputs "one thousand twenty four"
  str := num2words.Convert(1024, "es") // outputs "mil veinticuatro"
  ...
  str := num2words.Convert(-123, "en") // outputs "minus one hundred twenty three"
  str := num2words.Convert(-123, "es") // outputs "menos ciento veintitrés"

Convert number with " and " between number groups:

  str := num2words.ConvertAnd(514, "en") // outputs "five hundred and fourteen"
  str := num2words.ConvertAnd(514, "es") // outputs "quinientos y quince"
  ...
  str := num2words.ConvertAnd(123, "en") // outputs "one hundred and twenty three"
  str := num2words.ConvertAnd(123, "es") // outputs "ciento y veintitrés"