replacingCharacters(in:with:)

Returns a new string in which the characters in a specified range of the String are replaced by a given string.

Declaration

func replacingCharacters<T, R>(in range: R, with replacement: T) -> String where T : StringProtocol, R : RangeExpression, R.Bound == String.Index