xcode9 以上,黄色警告处理!,xcode9警告
分享于 点击 16343 次 点评:20
xcode9 以上,黄色警告处理!,xcode9警告
警告:'characters' is deprecated: Please use String or Substring directly
self.characters.count
解决:
let edit = "Summary"
edit.count //
警报:'substring(to:)' is deprecated: Please use String slicing subscript with a 'partial range upto' operator.
self.substring(to: self.index(of: Character(eT))!)
解决:
You should leave one side empty, hence the name "partial range".
let newStr = str[..<index]
The same stands for partial range from operators, just leave the other side empty:
let newStr = str[index...]
Keep in mind that these range operators return a Substring
. If you want to convert it to a string, use String
's initialization function:
let newStr = String(str[..<index])
You can read more about the new substrings here.
相关文章
- 暂无相关文章
用户点评