「Swift」配列を降順でソートするサンプル
1.string型配列
var strArr = ["buy", "info", "ark", "earn", "come"] strArr.sort { $0 > $1 } print(strArr)
2.int型配列
var cftArr = [44, 32, 45, 61, 73] cftArr.sort { $0 > $1 } print(cftArr)
Coding Changes the World
1.string型配列
var strArr = ["buy", "info", "ark", "earn", "come"] strArr.sort { $0 > $1 } print(strArr)
2.int型配列
var cftArr = [44, 32, 45, 61, 73] cftArr.sort { $0 > $1 } print(cftArr)