I have seen many methods for removing the last character from a string. Is there however a way to remove any old character based on its index?
Here is a safe Swift 4 implementation.
var s = "Hello, I must be going" var n = 5 if let index = s.index(s.startIndex, offsetBy: n, limitedBy: s.endIndex) { s.remove(at: index) print(s) // prints "Hello I must be going" } else { print("\(n) is out of range") }