Skip to content

Instantly share code, notes, and snippets.

@jweinst1
Created July 13, 2015 18:33
Show Gist options
  • Save jweinst1/65019622015f4c773e0a to your computer and use it in GitHub Desktop.
Save jweinst1/65019622015f4c773e0a to your computer and use it in GitHub Desktop.
Removes the last character in a string in Swift.
var str = "Hello, playground"
func removelastofstr(str: String) ->String {
var liststr = Array(str)
liststr.removeLast()
return String(liststr)
}
removelastofstr(str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment