Swift 取子字符串

前端之家收集整理的这篇文章主要介绍了Swift 取子字符串前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

let str = "0123456��画画…………"

let s1 = (str as NSString).substringFromIndex(3)

print(s1)

let index = str.startIndex.advancedBy(2)

debugPrint(index.dynamicType)

let s2 = str.substringFromIndex(index)

print(s2)


let tart = str.startIndex

let end = str.endIndex.advancedBy(-1)

let s3 = str.substringWithRange(tart..<end)

print(s3)

原文链接:/swift/324065.html

猜你在找的Swift相关文章