close
let rid = "23456"
let index = rid.index(rid.endIndex, offsetBy: -6, limitedBy: rid.startIndex)
let positionSerialNumber = rid.substring(from: index ?? rid.startIndex)
(超出索引可變nil,不會crash)
(可取出倒數6位字串)
參考資料:
https://developer.apple.com/reference/swift/indexable/1779407-index
全站熱搜
留言列表