Last active
February 11, 2018 11:23
-
-
Save erkekin/a1c233dc5b955d9eb036283b68286fa0 to your computer and use it in GitHub Desktop.
Gist to turn the sentence "MIDDLE EAST TECHNICAL UNIVERSITY" to "METU", Swift 4+
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
private func abbreviation(of sentence:String) -> String{ | |
return sentence | |
.components(separatedBy: CharacterSet.whitespacesAndNewlines) | |
.flatMap{$0.first} | |
.map{String($0)} | |
.joined(separator: "") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment