https://github.com/bestgopher/inflection
https://github.com/bestgopher/inflection
rust
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bestgopher/inflection
- Owner: bestgopher
- License: mit
- Created: 2021-11-08T00:38:54.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-09T03:57:52.000Z (over 4 years ago)
- Last Synced: 2025-04-06T18:51:18.492Z (about 1 year ago)
- Topics: rust
- Language: Rust
- Homepage: https://docs.rs/inflection
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# inflection(Just for learning)
Inflection pluralizes and singularizes English nouns implemented by rust.
Copy from [go version](https://github.com/jinzhu/inflection).
```rust
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());
```