Contents

replaceSubrange(_:with:)

Replaces the elements within the specified bounds with the given Unicode scalar values.

Declaration

mutating func replaceSubrange<C>(_ subrange: Range<String.UnicodeScalarView.Index>, with newElements: C) where C : Collection, C.Element == Unicode.Scalar

Parameters

  • subrange:

    The range of elements to replace. The bounds of the range must be valid indices of the view.

  • newElements:

    The new Unicode scalar values to add to the string.

Discussion

Calling this method invalidates any existing indices for use with this string.