Created
July 13, 2015 18:33
-
-
Save jweinst1/65019622015f4c773e0a to your computer and use it in GitHub Desktop.
Removes the last character in a string in Swift.
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
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