Skip to content

Instantly share code, notes, and snippets.

@Jamonek
Created November 20, 2015 12:54
Show Gist options
  • Save Jamonek/b5fb6f4a4da97999b6cd to your computer and use it in GitHub Desktop.
Save Jamonek/b5fb6f4a4da97999b6cd to your computer and use it in GitHub Desktop.
String extension to remove first character of a string in swift.
extension String {
var chomp : String {
mutating get {
self.removeAtIndex(self.startIndex)
return self
}
}
}
var test : String = "Chomp"
print(test.chomp) // homp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment