Git Product home page Git Product logo

number-to-words's Introduction

number-to-words

GoDoc Build Status Coverage Status Go Report Card

Convert numbers to words.

Converti les nombres en lettres.

Supported languages / Langues supportées

  • American English / United States of America [en] 🇺🇸
  • Français / France [fr] 🇫🇷
  • Italiano / Italy [it] 🇮🇹
  • Spanish / Spain [es] 🇪🇸
  • Swedish / Sweden [se] 🇸🇪
  • Dutch / Netherlands [nl] 🇳🇱
  • Roman numbers Ⅷ (with --unicode support)
  • Aegean numerals

CLI usage

$ number-to-words --lang=fr 42
quarante-deux

$ number-to-words --lang=it 42
quarantadue

$ number-to-words --lang=es 42
cuarenta y dos

$ number-to-words --lang=en 42
forty-two

$ number-to-words --lang=se 42
fyrtio-två

$ number-to-words --lang=nl 42
tweeenveertig

$ number-to-words --lang=roman 42
XLII

$ number-to-words --lang=roman --unicode 42
ⅩⅬⅡ

$ number-to-words --lang=aegean 42
𐄓𐄈

$ number-to-words 42
forty-two

$ number-to-words --lang=all 42
forty-two
quarante-deux
quarantadue
cuarenta y dos
fyrtio-två
tweeenveertig
XLII
𐄓𐄈

$ number-to-words --lang=all 1
one
un
uno
uno
en
één
I
𐄇

$ number-to-words --lang=all 1337
one thousand three hundred thirty-seven
mille trois cent trente-sept
uno mille trecento trentasette
un mil trescientos treinta y siete
en tusen tre hundra trettio-sju
éénduizend driehonderdzevenendertig
MCCCXXXVII
𐄢𐄛𐄒𐄍

$ number-to-words --lang=all 1234567890
one billion two hundred thirty-four million five hundred sixty-seven thousand eight hundred ninety
un milliard deux cent trente-quatre millions cinq cent soixante-sept mille huit cent quatre-vingt-dix
uno miliardo duecento trentaquattro milione cinquecento sessentasette mille ottocento novanta
un mil millones doscientos treinta y cuatro millones quinientos sesenta y siete mil ochocientos noventa
en miljarder två hundra trettio-fyra miljoner fem hundra sextio-sju tusen åtta hundra nittio
één miljard tweehonderdvierendertig miljoen vijfhonderdzevenenzestigduizend achthonderdnegentig

$ number-to-words --lang=all 1000000000000
one trillion
un billion
uno triliardo
un billón
en biljoner
één biljoen
too big number
too big number

--help

$ number-to-words -h
NAME:
   number-to-words - number to number

USAGE:
   number-to-words [global options] command [command options] [arguments...]

VERSION:
   0.1.0

AUTHOR(S):
   Manfred Touron <https://github.com/moul/number-to-words>

COMMANDS:
GLOBAL OPTIONS:
   --lang value, -l value   Set language (default: "en") [$NTW_LANGUAGE]
   --help, -h               show help
   --version, -v            print the version

Unicode support

Roman support the --unicode option.

$ for i in {1..20}; do ./number-to-words -l roman -u $i; done












ⅩⅢ
ⅩⅣ
ⅩⅤ
ⅩⅥ
ⅩⅦ
ⅩⅧ
ⅩⅨ
ⅩⅩ

API usage

import "github.com/moul/number-to-words"

fmt.Println(ntw.IntegerToFrench(42))
// Outputs: quarante-deux

fmt.Println(ntw.IntegerToEnglish(42))
// Outputs: forty-two

fmt.Println(ntw.IntegerToItalian(42))
// Outputs: quarantadue

fmt.Println(ntw.IntegerToSpanish(42))
// Outputs: cuarenta y dos

fmt.Println(ntw.IntegerToSwedish(42))
// Outputs: fyrtio-två

fmt.Println(ntw.IntegerToDutch(42))
// Outputs: tweeenveertig

fmt.Println(ntw.IntegerToRoman(42))
// Outputs: XLII

fmt.Println(ntw.IntegerToUnicodeRoman(42))
// Outputs: ⅩⅬⅡ

fmt.Println(ntw.IntegerToAegean(42))
// Outputs: 𐄓𐄈

Install

Using Golang

  1. install and configure go on your host
  2. get and build: go get github.com/moul/number-to-words/cmd/number-to-words
  3. profit: $GOPATH/bin/number-to-words 42

Using Homebrew

coming soon

Using Docker

  1. install and configure docker on your host
  2. profit: docker run --rm moul/number-to-words 42

License

MIT

number-to-words's People

Contributors

moul avatar faik avatar ehx avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.