Reserves enough space in the string’s underlying storage to store the specified number of ASCII characters.
SDK
- Xcode 10.0+
Framework
- Swift Standard Library
Declaration
Parameters
n
The minimum number of ASCII character’s worth of storage to allocate.
Discussion
Because each character in a string can require more than a single ASCII character’s worth of storage, additional allocation may be necessary when adding characters to a string after a call to reserve
.
Complexity: O(n)