Crates.io | pluralizer |
lib.rs | pluralizer |
version | 0.4.0 |
source | src |
created_at | 2022-02-25 12:00:04.387932 |
updated_at | 2023-03-09 14:53:49.641059 |
description | Rust package to pluralize or singularize any word based on a count inspired on pluralize NPM package |
homepage | |
repository | https://github.com/KennethGomez/pluralizer |
max_upload_size | |
id | 539376 |
size | 53,630 |
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
pluralizer.rs is available on crates.io. It is recommended to look there for the newest released version, as well as links to the newest builds of the docs.
At the point of the last update of this README, the latest published version could be used like this:
Add the following dependency to your Cargo manifest...
[dependencies]
pluralizer = "0.3.1"
...and see the docs for how to use it.
use pluralizer::pluralize;
fn main() {
pluralizer::initialize();
// It can convert to plural
println!("{}", pluralizer::pluralize("House", 2, true)); // 2 Houses
// But also can convert to singular
println!("{}", pluralizer::pluralize("Houses", 1, true)); // 1 House
// And keep singularization if needed
println!("{}", pluralizer::pluralize("House", 1, false)); // House
// Or keep pluralization
println!("{}", pluralizer::pluralize("Houses", 2, false)); // Houses
}
Licensed under either of
at your option
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.