Rust Numerals
Crate for converting i64
integers into their cardinal string format.
TODO
- Support localisation;
- Comma-support inside large strings;
-
number_to_ordinal
method for ordinals; -
number_to_roman
method for Roman ordinals; - Support multiple integer types
i8 .. i32
&u8 .. u64
; - Support multiple integer types
i8 .. i32
&u8 .. u64
; - Support floating point numbers
f32
&f64
;
Getting started
Add the following lines to your Cargo.toml
dependencies:
[]
= "0.1.0"
Examples
Convert a number to it's ordinal words.
use number_to_cardinal;
More examples
Using the i64
we can get numbers into the quintillions, which is probably larger than most projects needs.
number_to_cardinal; // zero
number_to_cardinal; // eight
number_to_cardinal; // fourteen
number_to_cardinal; // twenty-three
number_to_cardinal; // one hundred eight
number_to_cardinal; // one thousand two hundred and fifty-six
number_to_cardinal; // one thousand one hundred
number_to_cardinal; // eleven thousand eleven
number_to_cardinal; // twenty-one thousand twenty-five
number_to_cardinal; // ninety-nine thousand nine hundred and ninety-nine
number_to_cardinal; // one million one thousand
number_to_cardinal; // one million sixty-one thousand forty-four
number_to_cardinal; // two trillion
number_to_cardinal; // two quintillion eight hundred and ninety-two trillion five hundred and sixty million fifty-six thousand
number_to_cardinal; // one quintillion one hundred quadrillion one hundred trillion one hundred billion one hundred million one hundred thousand one hundred and one
License
Licensed under MIT license (LICENSE or https://opensource.org/licenses/MIT).