var str = "Hello, playground"
//let index = str.index(str.startIndex, offsetBy: 5)
//str.substring(to: index)
let strlength:Int = str.characters.count - 10
let index = str.index(str.startIndex, offsetBy: strlength)
str.substring(to: index)
str.substring(from: index)
let start = str.index(str.startIndex, offsetBy: 1)
let end = str.index(str.endIndex, offsetBy: 0)
let range = start..<end
str.substring(with: range)
swift 3.0 字符串截取
最新推荐文章于 2020-12-22 17:15:50 发布