Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn studly_caps(s: &str) -> String {
- s.to_uppercase()
- .chars()
- .map(|c| {
- if c.is_alphabetic() && c > 'M' {
- c.to_ascii_lowercase()
- } else {
- c
- }
- })
- .collect()
- }
- fn main() {
- println!("{}", studly_caps("hello world"));
- }
Add Comment
Please, Sign In to add comment