Last active
August 2, 2016 10:53
-
-
Save JaNd3r/1f04e998703b86e630278f9955e12980 to your computer and use it in GitHub Desktop.
String extension which adds a function that returns the string with only its first character capitalized.
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
extension String { | |
func firstToUpper() -> String { | |
return self.isEmpty ? "" : String(self.characters.first!).uppercaseString + String(self.characters.dropFirst()).lowercaseString | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment