Last active
January 22, 2016 20:11
-
-
Save ericdke/5b8aef3d08e8ea72cb2b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| extension String { | |
| var acronym:String { | |
| let chSet = NSMutableCharacterSet.punctuationCharacterSet() | |
| chSet.addCharactersInString("\n\r ") | |
| let words = self.componentsSeparatedByCharactersInSet(chSet) | |
| let letters = words.flatMap { $0.characters.first }.map { String($0) } | |
| return letters.joinWithSeparator("").uppercaseString | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment