removeAll(keepingCapacity:)
Replaces this string with the empty string.
Declaration
mutating func removeAll(keepingCapacity keepCapacity: Bool = false)Parameters
- keepCapacity:
Pass
trueto 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 isfalse.
Discussion
Calling this method invalidates any existing indices for use with this string.