Swift3废除了subString(from\to\with:)字符串截取方法。
而截取方法改成了:
let newStr = String(str[..<index]) // = str.substring(to: index) In Swift 3
let newStr = String(str[index...]) // = str.substring(from: index) In Swif 3
let newStr = String(str[range]) // = str.substring(with: range) In Swift 3
网友评论