Does String type in Swift have a splice(_:atIndex:) method?

In Apple's official book "The Swift Programming Language", it says :"... To insert another string at a specified index, use the splice(_:atIndex:) method.." in String section, this is weird because there isn't this splice() method. Instead it should be insertContentsOf(). So is the book wrong or?

Answered by OOPer in 54675022

This is taken from the Xcode 7 beta 6 release notes:


The method RangeReplaceableCollectionType.extend() was renamed to appendContentsOf(),

and the splice() method was renamed to insertContentsOf(). (21972324)


It seems the Swift book you use is not properly updated yet.

I think the latest online version The Swift Programming Language (Swift 2) should reflect the latest changes, and if not, you can send a Bug Report.

Accepted Answer

This is taken from the Xcode 7 beta 6 release notes:


The method RangeReplaceableCollectionType.extend() was renamed to appendContentsOf(),

and the splice() method was renamed to insertContentsOf(). (21972324)


It seems the Swift book you use is not properly updated yet.

I think the latest online version The Swift Programming Language (Swift 2) should reflect the latest changes, and if not, you can send a Bug Report.

Thanks! I didn't know there is a "iOS Developer Library - Prerelease". The link you provided did reflect the changes.

Does String type in Swift have a splice(_:atIndex:) method?
 
 
Q