I want to delete 5 characters in a string, so I plan to use a loop to do that. but actually code not report any error, but still, I can only delete one character
var i = Int()
repeat {
proxy.deleteBackward();
i = i+1
} while i<5
I want to delete 5 characters in a string, so I plan to use a loop to do that. but actually code not report any error, but still, I can only delete one character
var i = Int()
repeat {
proxy.deleteBackward();
i = i+1
} while i<5
if you want to remove last 5 characters of your string , use
myString.dropLast(5)
if you want to run your deleteBackward() method 5 times, use like this
var i = 0
while i<5 {
proxy.deleteBackward()
i += 1
}