Skip to content

Instantly share code, notes, and snippets.

@Ms2ger
Created December 24, 2014 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Ms2ger/83d07a3df86707245b4d to your computer and use it in GitHub Desktop.
Save Ms2ger/83d07a3df86707245b4d to your computer and use it in GitHub Desktop.
let mut result = "".into_string();
let mut chars = remainder.chars();
loop {
match chars.next() {
Some('-') => {
match chars.next() {
Some(c) if 'a' <= c && c <= 'z' => {
result.push(c.to_uppercase());
},
Some(c) => {
result.push('-');
result.push(c);
},
None => {
result.push('-');
break;
},
}
},
Some(c) => {
result.push(c);
}
None => break,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment