let str = "Hello world!"
let index = advance(str.startindex, 7)//这个报错
求具体怎么改
把advance方法改成advancedBy
let str = "Hello world!"
//let index = advance(str.startindex, 7)
let index = str.startIndex.advancedBy(7)
把7改成-7试试,我觉得可能OK
let likeGirlsType = "wo xi huan ai xiao de nv sheng!"
// let index = advance(likeGirlsType.startIndex,9) 已经淘汰
// 方法换啦!!!
let index = likeGirlsType.startIndex.advancedBy(9)
print(likeGirlsType[index]) // 输出结果是 n