Crate pluralizer
source ·Expand description
Rust package to pluralize or singularize any word based on a count inspired on pluralize NPM package.
It will keep plurals are plurals if the count given is not 1, either way, it is going to keep the singular form if the count given is 1
Example
use pluralizer::pluralize;
fn main() {
// It can convert to plural
println!("{}", pluralize("House", 2, true)); // 2 Houses
// But also can convert to singular
println!("{}", pluralize("Houses", 1, true)); // 1 House
// And keep singularization if needed
println!("{}", pluralize("House", 1, false)); // House
// Or keep pluralization
println!("{}", pluralize("Houses", 2, false)); // Houses
}
Enums
- Uncountable rule struct
Functions
- Add an irregular word definition.
- Add a pluralization rule to the collection.
- Add a singularization rule to the collection.
- Add an uncountable word rule.
- Pluralize or singularize a word based on the passed in count.