Skip to content

Instantly share code, notes, and snippets.

@mlvea
Created January 13, 2017 11:51
Show Gist options
  • Save mlvea/f51e495f26a8986de90b1bc87ec4320f to your computer and use it in GitHub Desktop.
Save mlvea/f51e495f26a8986de90b1bc87ec4320f to your computer and use it in GitHub Desktop.
Abbreviation from CamelCase String
extension String {
func abbrevatedByCapitalLetters() -> String {
var abbrevations = [Character]()
for character in self.characters where String(character) == String(character).uppercased() {
abbrevations.append(character)
}
return String(abbrevations)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment