Unicode Titlecase
Unicode titlecasing operations for chars and strings. The crate supports has additional functionality to support the TR/AZ locale.
Installation
Add this to your Cargo.toml:
[]
= "1.1.0"
Features
This crate is no_std capable. std is used for
std::Display on the iterators and for the "strings" feature. The "strings" feature
enables functions that operation on Rust Strings.
Usage
Chars
To turn a char into its titlecase equivalent [char; 3]array:
use to_titlecase;
assert_eq!;
assert_eq!;
assert_eq!;
Or use the iterator version that follows the same format as the std library. The crate defines
a Trait that is implemented on char:
use TitleCase;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Strings
A similar trait is defined on str if the "strings" feature is enabled (by default). This
will titlecase the first char of the string, leave the rest unchanged, and return a newly
allocated String.
use StrTitleCase;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Alternatively, you could lowercase the rest of the str:
use StrTitleCase;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Locale
The TR and AZ locales have different rules for how to titlecase certain characters.
The to_titlecase functions assume the locale is neither of these locations. A "tr_or_az"
version of each function is provided instead.
use ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
License
unicode_titlecase is licensed under the MIT License