在Swift中创建子字符串时崩溃

时间:2018-03-20 08:01:49

标签: ios swift string substring bidirectional

创建字符串偏移量时,遇到罕见的崩溃:

specialized specialized _BidirectionalIndexable.index(A.Index, offsetBy : A.IndexDistance) -> A.Index**

这是我的代码:

let cloud_data ="2332333223325#"
let data_substring = "test-" + cloud_data.substring(from:cloud_data.index(cloud_data.endIndex, offsetBy: -4))

这是上面的代码,用于获取子字符串。行号73是上面的行号。附上日志截图:

enter image description here

0 个答案:

没有答案