Contents

removeAll(keepingCapacity:)

Replaces this string with the empty string.

Declaration

mutating func removeAll(keepingCapacity keepCapacity: Bool = false)

Parameters

  • keepCapacity:

    Pass true to prevent the release of the string’s allocated storage. Retaining the storage can be a useful optimization when you’re planning to grow the string again. The default value is false.

Discussion

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

See Also

Removing Substrings