-
-
Save eddyb/81fb9edf198aceecb2f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mut result = "".into_string(); | |
let mut chars = remainder.chars(); | |
while let Some(c) = chars.next() { | |
if c == '-' { | |
match chars.next() { | |
Some(c @ 'a'...'z') => { | |
result.push(c.to_uppercase()); | |
} | |
Some(c) => { | |
result.push('-'); | |
result.push(c); | |
} | |
None => { | |
result.push('-'); | |
break; | |
} | |
} | |
} else { | |
result.push(c); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment