Below is the following line of code I use to replace an HTML break tag with a carriage return. However, I have other HTML symbols that I need to replace and when I call this lin
Use replacingOccurrences along with a the String.CompareOptions.regularExpresion option.
Example (Swift 3):
var x = ""
let y = x.replacingOccurrences(of: "[\\[\\]^+<>]", with: "7", options: .regularExpression, range: nil)
print(y)
Input characters which are to be replaced inside the square brackets like so [\\ Characters]
Output:
7Hello, 7play7ground777