| Crates.io | in_definite |
| lib.rs | in_definite |
| version | 1.1.2 |
| created_at | 2019-09-18 20:35:13.057981+00 |
| updated_at | 2025-09-06 10:10:29.948234+00 |
| description | Get the indefinite article ('a' or 'an') to match the given word. For example: an umbrella, a user. |
| homepage | |
| repository | https://github.com/mrseanryan/in_definite |
| max_upload_size | |
| id | 165813 |
| size | 27,906 |
Rust port of indefinite on npm, for deciding which indefinite article to use ('a' or 'an').
Get the indefinite article ('a' or 'an') to match the given word. For example: an umbrella, a user.
use in_definite;
let result = in_definite::get_a_or_an("alien");
assert_eq!("an", result);
// Irregular word
let result = in_definite::get_a_or_an("unicorn");
assert_eq!("a", result);
// Title Case
let result = in_definite::get_a_or_an("Ugly");
assert_eq!("An", result);
let result = in_definite::is_an("alien");
assert_eq!(in_definite::Is::An, result);
let result = in_definite::is_an("unicorn");
assert_eq!(in_definite::Is::A, result);
note: detecting plurals is not supported.
indefiniteUpper/lower/mixed case handling:
Adverbs:
A big thanks to the original authors of indefinite!
See in_definite_cmd_published for the command line tool which consumes the library.
./go-published.sh umbrella
Output
= in_definite =
===============
an umbrella
https://crates.io/crates/in_definite
This project is licensed under the MIT License - see the LICENSE file for details