Git Product home page Git Product logo

numbers_in_words's Introduction

Build Status Dependency Status Code Climate Test Coverage Gem Version License Badges

Installation

gem 'numbers_in_words'

Usage

require 'numbers_in_words'

NumbersInWords.in_words(112)
#=> one hundred and twelve

NumbersInWords.in_numbers("one googol")
#=>10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

NumbersInWords.in_numbers("Seventy million, five-hundred and fifty six thousand point eight nine three")
#=> 70556000.893

NumbersInWords.in_numbers("nineteen sixty five")
#=> 1965

Monkey patch version

require 'numbers_in_words'
require 'numbers_in_words/duck_punch'
112.in_words
#=> one hundred and twelve

"one googol".in_numbers
#=>10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

"Seventy million, five-hundred and fifty six thousand point eight nine three".in_numbers
#=> 70556000.893

numbers_in_words's People

Contributors

markburns avatar dimidd avatar trak3r avatar

Stargazers

 avatar annebeth avatar

Watchers

James Cloos avatar  avatar

numbers_in_words's Issues

Edge case: twothousand

There is a small bug, I´d not necessarily expect for the package to get it right, but maybe it would be good to throw an error if there are strings in there it doesn´t understand...

print(w2n.word_to_num('twothousand and one'))
1
print(w2n.word_to_num('two thousand and one'))
2001

Thanks for the package :)

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.