1 2 3 4 5 6 7 8 9 10 11 12
#![allow(dead_code)] pub fn title_case(s: &str) -> String { let mut chars = s.chars(); match chars.next() { None => String::new(), Some(f) => f .to_uppercase() .chain(chars.flat_map(|t| t.to_lowercase())) .collect(), } }