I am looking for a way to replace characters in a Swift String.
String
Example: \"This is my string\"
I would like to replace \" \" with \"+\" to get \
This is easy in swift 4.2. just use replacingOccurrences(of: " ", with: "_") for replace
replacingOccurrences(of: " ", with: "_")
var myStr = "This is my string" let replaced = myStr.replacingOccurrences(of: " ", with: "_") print(replaced)