How can I replace a specific char with a string?
2 answers
You can also use the stringByReplacingOccurrencesOfString function like this:
var s = "bolooooooo"
s.stringByReplacingOccurrencesOfString("o", withString: "e", options: NSStringCompareOptions.LiteralSearch, range: Range<String.Index>(start: advance(s.startIndex, 2), end: s.endIndex))
Output:
boleeeeeee
+3
source to share