import Foundation let s = "one two two three" // returns a new String with every match replaced let fixed = s.replacingOccurrences(of: "two", with: "2") print(fixed)
replacingOccurrences(of:with:)