num2words
Convert number like 42 to forty-two
Usage
This crate can be either used as a library or a binary.
Library
Example usage:
use Num2Words;
assert_eq!;
The builder Num2Words can take any of these arguments: lang, cardinal,
ordinal, ordinal_num, year, and currency.
use *;
assert_eq!;
assert_eq!;
assert_eq!;
These arguments can be chained.
For more information about the available languages, outputs and currencies, see Information.
Binary
This crate provides a command-line interface to run requests on num2words.
Example:
You can download the app via the following command:
You can also change the language via the argument --lang and provide an
output or a currency with the argument --to.
For more information about the usage of num2words please refer to the docs
or via the following command:
Information
Supported languages
Here is a list of all of the supported languages:
| Flag | Code | CLI code | Language | 42 |
|---|---|---|---|---|
| πΊπΈπ¬π§ | Lang::English |
en |
English | forty-two |
This list can be expanded! Contributions are welcomed.
Supported output
Here is a list of all of the supported outputs (with the command-line interface code):
Output::Cardinal(cardinal): forty-two (42)Output::Currency(any available currencies): forty-two dollars and one cent (42.01)Output::Ordinal(ordinal): forty-second (42)Output::OrdinalNum(ordinal_num): 42nd (42)Output::Year(year): nineteen oh-one (1901)
Supported currencies
Here is a list of all of the supported currencies (with the command-line interface code):
Currency::AUD(AUD): australian dollarCurrency::CAD(CAD): canadian dollarCurrency::DOLLAR(DOLLAR): dollarCurrency::EUR(EUR): euroCurrency::GBP(GBP): poundCurrency::USD(USD): US dollar
About
This library is widely inspired by Savoir-faire Linux's Python lib.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.