Contents

replaceCharacters(in:with:)

Replaces the characters in the given range with the characters of the given string.

Declaration

func replaceCharacters(in range: NSRange, with str: String)

Parameters

  • range:

    A range specifying the characters to replace.

  • str:

    A string specifying the characters to replace those in range.

Discussion

The new characters inherit the attributes of the first replaced character from range. Where the length of range is 0, the new characters inherit the attributes of the character preceding range if it has any, otherwise of the character following range.

Raises an rangeException if any part of range lies beyond the end of the receiver’s characters.

See Also

Changing Characters