我直接写成:
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 )
可以实现 但是 请老师帮看看
写的挺好的