# namecase-rs
A Rust library for converting names to proper case with intelligent handling of special naming conventions.
## Library Usage
### Basic Usage
```rust
use namecase::{namecase, NamecaseOptions};
fn main() {
// Simple usage with default options
let name = namecase("JOHN DOE", NamecaseOptions::default());
println!("{}", name); // Output: "John Doe"
// Handle special cases
println!("{}", namecase("MCCONNELL", NamecaseOptions::default())); // "McConnell"
println!("{}", namecase("MACDONALD", NamecaseOptions::default())); // "MacDonald"
println!("{}", namecase("HENRY VIII", NamecaseOptions::default())); // "Henry VIII"
}
```
### Options
```rust
use namecase::{namecase, NamecaseOptions};
fn main() {
let options = NamecaseOptions {
// Preserve mixed-case input (skip processing if already mixed)
enable_preserve_mixed: true,
// Allow lowercase at start (e.g. "von Trapp" instead of "Von Trapp")
enable_lowercase_start: true,
// Disable specific features if needed
disable_hebrew: false,
disable_spanish: false,
disable_roman_numerals: false,
disable_postnominal: false,
};
println!("{}", namecase("von Neumann", options));
}
```
## CLI Usage
Process names from the command line:
```bash
# Basic usage
cargo run -- "JOHN DOE"
# Output: John Doe
# Preserve mixed case input
cargo run -- --enable-preserve-mixed "John Smith"
# Output: John Smith
# Allow lowercase start (preserves prefixes like "von", "van", "de")
cargo run -- --enable-lowercase-start "von Neumann"
# Output: von Neumann
```
### CLI Options
- `--enable-preserve-mixed`: Skip processing if input is already mixed case
- `--enable-lowercase-start`: Allow lowercase at start of name
- `--disable-hebrew`: Disable Hebrew "ben"/"bat" prefix handling
- `--disable-spanish`: Disable Spanish "el"/"la"/"y" capitalization
- `--disable-roman-numerals`: Disable Roman numeral uppercasing
- `--disable-postnominal`: Disable post-nominal initials preservation
## Data Source
The naming rules are derived from the [Lingua::EN::NameCase](https://metacpan.org/pod/Lingua::EN::NameCase) Perl module, which is licensed under the Artistic License 2.0. No affiliation or endorsement is implied.
## License
This project is dual-licensed under either of:
- MIT license (see `LICENSE-MIT`)
- Apache License, Version 2.0 (see `LICENSE-APACHE`)
You may choose either license.
---
**Provenance note**: Portions of this repository were generated with the help of AI tooling under the direction of the repository maintainer. Review and verify any third-party data or content included for suitability in your use case.