字符串比較
我直接寫(xiě)成:
var strArr = ["d", "cd", "bcd", "abcd", "abc", "ab", "a"]
sorted( strArr )
func compareTwoString(s1:String, s2:String)->Bool{return
? ? countElements(s1) < countElements(s2) || countElements(s1) == countElements(s2) ? (s1 < s2) : false
}
sorted(strArr, compareTwoString )
可以實(shí)現(xiàn) ?但是 請(qǐng)老師幫看看
2015-03-10
寫(xiě)的挺好的