Guest User

Untitled

a guest
Apr 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. fn studly_caps(s: &str) -> String {
  2. s.to_uppercase()
  3. .chars()
  4. .map(|c| {
  5. if c.is_alphabetic() && c > 'M' {
  6. c.to_ascii_lowercase()
  7. } else {
  8. c
  9. }
  10. })
  11. .collect()
  12. }
  13.  
  14. fn main() {
  15. println!("{}", studly_caps("hello world"));
  16. }
Add Comment
Please, Sign In to add comment