您可以
offsetBy:从
.startIndex:
Swift 2(已淘汰)let mySet: Set = ["a", "b", "c", "d"]mySet[mySet.index(mySet.startIndex, offsetBy: 2)] // -> something from the set.
您可以
advancedBy()从
.startIndex:
Swift 1.x(已淘汰)let mySet: Set = ["a", "b", "c", "d"]mySet[mySet.startIndex.advancedBy(2)] // -> something from the set.
与相似
String,您必须
advance()从
.startIndex:
let mySet: Set = ["a", "b", "c", "d"]mySet[advance(mySet.startIndex, 2)] // -> something from the set.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)