I'm trying to insert a specific character in a specific index in a string lets say
var text = "1234567890"
i want that variable to add the country code of the phone number:
text = text.replacingCharacters(in: text.startIndex..<text.index(after: text.startIndex), with: "+593\\U00a0")
Then i have to format that string into something like this: "+593 23-456-7890", so i have to insert "-" into the index 8 and 11 but i have only found answers with swift 2.0. Strings had a method called insert that doesn't exists anymore. i've tried this:
text = text.insert("-", at: text.index(text.startIndex, offsetBy: +8))
but I have the following error "Cannot assign value of type '()' to type 'String'