【发布时间】:2019-05-17 17:56:10
【问题描述】:
在这个例子中:
var str1 = "hello"
var str2 = "Hello"
if str1 < str2 { print("hello is less than Hello")}
else {print("hello is more than Hello")}
根据什么发现str1大于str2?
【问题讨论】:
-
H的 ascii 十进制值72和h的 ascii 十进制值104这不是很明显。就像strcmpin C 上的第一个索引h大于H这就是为什么结果如此。