Skip to content

Instantly share code, notes, and snippets.

@JaNd3r JaNd3r/FirstToUpper.swift
Last active Aug 2, 2016

What would you like to do?
String extension which adds a function that returns the string with only its first character capitalized.
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
You can’t perform that action at this time.