更新时间:2023-11-15 09:06:40
试试这个:
对于旧版的swift:
For older swift:
var a : String = "Cash"
var b : String = "cash"
if(a.caseInsensitiveCompare(b) == NSComparisonResult.OrderedSame){
println("voila")
}
Swift 3.0
Swift 3.0
if(a.caseInsensitiveCompare(b) == ComparisonResult.orderedSame){
print("voila")
}