inflection

Crates.ioinflection
lib.rsinflection
version0.1.2
sourcesrc
created_at2021-11-08 00:46:57.792967
updated_at2021-11-09 03:58:07.07214
descriptionPluralizes and singularizes English nouns
homepage
repositoryhttps://github.com/bestgopher/inflection
max_upload_size
id478292
size22,262
bestgopher (bestgopher)

documentation

https://docs.rs/inflection

README

inflection(Just for learning)

Inflection pluralizes and singularizes English nouns implemented by rust.

Copy from go version.

use inflection::{singular, plural};


assert_eq!(plural::<_, String>("person"), "people".to_string());
assert_eq!(plural::<_, String>("Person"), "People".to_string());
assert_eq!(plural::<_, String>("PERSON"), "PEOPLE".to_string());
assert_eq!(plural::<_, String>("bus"), "buses".to_string());
assert_eq!(plural::<_, String>("BUS"), "BUSES".to_string());
assert_eq!(plural::<_, String>("Bus"), "Buses".to_string());
assert_eq!(plural::<_, String>("FancyPerson"), "FancyPeople".to_string()); 
                                                                             
assert_eq!(singular::<_, String>("people"), "person".to_string());           
assert_eq!(singular::<_, String>("PEOPLE"), "PERSON".to_string());           
assert_eq!(singular::<_, String>("buses"), "bus".to_string());               
assert_eq!(singular::<_, String>("People"), "Person".to_string());           
assert_eq!(singular::<_, String>("BUSES"), "BUS".to_string());               
assert_eq!(singular::<_, String>("Buses"), "Bus".to_string());               
assert_eq!(singular::<_, String>("FancyPeople"), "FancyPerson".to_string()); 
Commit count: 8

cargo fmt