github.com/crystal-castles/words_to_numbers
master / published Aug 30, 2020 / repository
Convert a string of words to the number they describe, e.g. Twenty three = 23.
Words to Numbers
Simple words to numbers parser (BigInt supported only).
For example:
"Three hundred and twelve" = 312
Installation
Add this to your application's shard.yml:
dependencies:
words_to_numbers:
github: crystal-castles/words_to_numbers
Usage
words_to_numbers is an extension of String
require "words_to_numbers"
# Parse string of words to numbers
number = "Seventeen thousand".words_to_numbers
#=> 17000
Development
This library's specs are put in spec directory.
They can run by crystal spec command.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Add test(s) in
spec/to cover your changes & write some code, until your test are passing. - Commit your changes (
git commit -am 'Describe your change') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request on github
License
MIT
(c) Jason Milkins - 2020 crystal-castles
Contributors
- Jason Milkins
API
- String
A
Stringrepresents an immutable sequence of UTF-8 characters.