Expand description
titlecase
capitlizes English text according to a style defined by John
Gruber for post titles on his website Daring Fireball.
§Example
use titlecase::{titlecase, Titlecase};
let text = "a sample title to capitalize: an example";
assert_eq!(text.titlecase(), "A Sample Title to Capitalize: An Example");
assert_eq!(titlecase(text), "A Sample Title to Capitalize: An Example");
§Style
Instead of simply capitalizing each word it does the following (amongst other things):
- Lower case small words like an, of, or in.
- Don’t capitalize words like iPhone.
- Don’t interfere with file paths, URLs, domains, and email addresses.
- Always capitalize the first and last words, even if they are small words or surrounded by quotes.
- Don’t interfere with terms like “Q&A”, or “AT&T”.
- Capitalize small words after a colon.
Traits§
- Titlecase
- A trait describing an item that can be converted to title case.
Functions§
- titlecase
- Returns
input
in title case.