var s="abcdefghijk" let index = advance(s.startIndex,5) let index2 = advance(s.endIndex,-6) let start = advance(s.startIndex,2) let end = advance(s.startIndex,6) s.substringToIndex(index2) s.substringFromIndex(advance(s.startIndex,5)) //截取 第三个往后 s.substringFromIndex(advance(s.startIndex,3)) //截取 第 N -M 个 s.substringWithRange(Range(start: start,end: end))
swift 2 方法:
大方
大方