Is there a quick way to remove the last two characters in a String in Swift? I see there is a simple way to remove the last character as clearly noted here. Do you know ho
var name: String = "Dolphin" let endIndex = name.index(name.endIndex, offsetBy: -2) let truncated = name.substring(to: endIndex) print(name) // "Dolphin" print(truncated) // "Dolph"