一.示例代码如下:
let tempMinArr = minDyArr.sorted { (m1, m2) -> Bool in
return Int(m1)! < Int(m2)!
}
问题:需要排序的数组中如果装入的有像"90.00"这类的浮点型字符串,那么会导致崩溃。
问题处理:
let tempMinArr = minDyArr.sorted { (m1, m2) -> Bool in
return Double(m1)! < Double(m2)!
}
or
let tempMinArr = minDlArr.sorted { (m1, m2) -> Bool in
return (m1 as NSString).intValue < (m2 as NSString).intValue
}