我有一个像这样的数组:
( "8461.86","8468.22","8468.22","8162.59","8164.50","7280.59" )
我尝试按以下顺序对这个数组进行排序:
sortedArray = [arr_distance sortedArrayUsingComparator:^(id firstObject, id secondObject) {
return [((NSString *)firstObject) compare:((NSString *)secondObject) options:NSNumericSearch];
}];
但我得到了以下数组:
( "7280.59","8162.59","8164.50","8461.86","8468.22","8468.22" )
为什么会这样?
我也尝试喜欢
return [firstObject compare:secondObject options:NSNumericSearch];
但没有得到正确的排序数组。