Why is capitalizing the first letter of a string such a non-trivial task in Rust?
Hello, colleagues!\n\nI relatively recently started learning Rust, coming from Python and JavaScript. There it's simple: `"hello".capitalize()` or `str[0].toUpperCase() + str.slice(1)`. But in Rust I encountered that even such a basic operation as capitalizing the first letter of a string requires a song and dance.\n\nI wrote this code:\n\n```rust\nfn capitalize_first(s: &str) -> String {\n let mut chars = s.chars();\n match chars.next() {\n Some(first) => first.to_uppercase().to_string() + chars.as_str(),\n None => String::new(),\n }\n}\n\nfn main() {\n println!("{}", capitalize_first("hello")); // want "Hello"\n println!("{}", capitalize_first("привет")); // want "Привет"\n}\n```\n\nAt first glance, everything works. But when I tried to process the string `"straße"`