【发布时间】:2016-09-28 16:11:09
【问题描述】:
我已迁移到 Swift 3.0,但现在在这一行出现错误:
let lastFourDigits = (accountNumber as NSString).substringWithRange(accountNumber.endIndex.advancedBy(-4)..<accountNumber.endIndex)
No '..<' candidates produce the expected contextual result type 'NSRange' (aka '_NSRange')。我在这里做错了什么?
【问题讨论】:
-
let lastFourDigits = String(accountNumber.characters.suffix(4))