目前我正在使用xcode8.調用函數的時候需要參數的名字,像這樣
sayHello(name:"慕課女神")
sayHello(name:"慕課女神")
2017-06-28
3.0 trim
var str_c = " a c c "
str_c.trimmingCharacters(in: .whitespacesAndNewlines)
var str_c = " a c c "
str_c.trimmingCharacters(in: .whitespacesAndNewlines)
2017-05-16
newArr.sorted(by: {(a: Int, b: Int) -> Bool in
return a > b
})
可以寫成這樣哦
newArr.sorted(by: {
return $0 > $1
})
return a > b
})
可以寫成這樣哦
newArr.sorted(by: {
return $0 > $1
})
2017-04-13
func compareTwoString(s1: String, s2: String) -> Bool {
return s1.characters.count == s2.characters.count ? s1 < s2 : s1.characters.count < s2.characters.count
}
return s1.characters.count == s2.characters.count ? s1 < s2 : s1.characters.count < s2.characters.count
}
2017-04-12