I am trying to read the string from a Label and remove the last character form it.
This is how I am trying:
@IBAction func del(sender: UIButton) {
let str = telephone.text!;
let newstr = str.remove(at: str.index(before: str.endIndex))
telephone.text = newstr;
}
When I run, I get an error:
"String" does not have a member named "remove"
Can someone help me figure out the problem? Just started learning swift :(
let str = "Test"for testing purposes. Btw, you don't need to use;at the end of a line.remove(at:)mutates the receiver and expects a variable.var str = telephone.text!.