insert(_:at:)
Inserts into the receiver the characters of a given string at a given location.
Declaration
func insert(_ aString: String, at loc: Int)Parameters
- aString:
The string to insert into the receiver.
aStringmust not benil. - loc:
The location at which
aStringis inserted. The location must not exceed the bounds of the receiver.
Discussion
The new characters begin at loc and the existing characters from loc to the end are shifted by the length of aString.
This method treats the length of the string as a valid index value that returns an empty string.