消除警告 'substring(from:)' is deprecated: Please use String slicing subscript with a 'partial...

swift3 消除警告 'substring(from:)' is deprecated: Please use String slicing subscript with a 'partial range from' operator.

Swift3废除了subString(from\to\with:)字符串截取方法

而截取方法改成了:

let newStr = String(str[..

let newStr = String(str[index...]) // = str.substring(from: index) In Swif 3

let newStr = String(str[range]) // = str.substring(with: range) In Swift 3

你可能感兴趣的:(swift)