This crate transforms a number into its French representation.
In your Cargo.toml
, put:
ini
[dependencies]
french-numbers = "0.1"
You can then use the french_number
function from the french_numbers
crate
to format any integer into the beautiful French romance language:
``` rust use frenchnumbers::frenchnumber;
asserteq!(frenchnumber(&71), "soixante-et-onze"); asserteq!(frenchnumber(&1001), "mille-un"); asserteq!(frenchnumber(&-200001), "moins deux-cent-mille-un"); asserteq!(frenchnumber(&-200000001), "moins deux-cents-millions-un"); asserteq!(frenchnumber(&-204000001), "moins deux-cent-quatre-millions-un"); ```
You can also request the use of the feminine form, or prefer the previous way of writing numbers predating the 1990 orthographic reform:
```rust use french_numbers::*;
asserteq!(frenchnumberoptions(&251061, &Options { feminine: false, reformed: true}), "deux-cent-cinquante-et-un-mille-soixante-et-un"); asserteq!(frenchnumberoptions(&251061, &Options { feminine: true, reformed: true}), "deux-cent-cinquante-et-un-mille-soixante-et-une"); asserteq!(frenchnumberoptions(&251061, &Options { feminine: true, reformed: false }), "deux cent cinquante-et-un mille soixante-et-une"); asserteq!(frenchnumberoptions(&251061, &Options { feminine: false, reformed: false }), "deux cent cinquante-et-un mille soixante-et-un") ```