Skip to content

Instantly share code, notes, and snippets.

@mikeymckay
Created August 8, 2008 19:28
Show Gist options
  • Save mikeymckay/4617 to your computer and use it in GitHub Desktop.
Save mikeymckay/4617 to your computer and use it in GitHub Desktop.
class String
def change_case
self.gsub(/([A-Z]*)([a-z]*)/){"#{$1}".downcase + "#{$2}".upcase}
end
end
"UPUPdowndownLeftrIGHTlEFTrightBABAstart".change_case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment