【发布时间】:2019-05-09 19:07:45
【问题描述】:
看程序:
let s = "1"
print(s.startIndex)
print(s.index(before: s.endIndex))
print(s.index(before: s.endIndex) == s.startIndex)
返回:
Index(_rawBits: 0)
Index(_rawBits: 256)
true
那么,字符串中的相同位置用 rawBits 0 和 256 表示。为什么?
【问题讨论】:
-
你为什么要看
rawBits? -
可能是 print() 命令的问题,而不是相等性