replacingOccurrences(of:with:options:range:)

Returns a new string in which all occurrences of a target string in a specified range of the string are replaced by another given string.

Declaration

func replacingOccurrences<Target, Replacement>(of target: Target, with replacement: Replacement, options: String.CompareOptions = [], range searchRange: Range<Self.Index>? = nil) -> String where Target : StringProtocol, Replacement : StringProtocol