Instance Method

replacingCharacters(in:with:)

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

Declaration

func replacingCharacters(in range: NSRange, with replacement: String) -> String

Parameters

range

A range of characters in the receiver.

replacement

The string with which to replace the characters in range.

Return Value

A new string in which the characters in range of the receiver are replaced by replacement.

See Also

Replacing Substrings

func replacingOccurrences(of: String, with: String)

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

func replacingOccurrences(of: String, with: String, options: NSString.CompareOptions = [], range: NSRange)

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