Swift String – Remove Last Character
To remove last character of a String in Swift, call removeLast() method on this string.
String.removeLast() method removes the last character from the String.
In the following program, we will take a string and remove its last character using removeLast() method.
var str = "Hello World" str.removeLast() print(str)
In this Swift Tutorial, we learned how to remove the last character of a String in Swift.