Inserts a new character at the specified position.
SDK
- Xcode 10.0+
Framework
- Swift Standard Library
Declaration
Parameters
newElementThe new character to insert into the string.
iA valid index of the string. If
iis equal to the string’s end index, this methods appendsnewto the string.Element
Discussion
Calling this method invalidates any existing indices for use with this string.
Complexity: O(n), where n is the length of the string.