NSString *num1 = @"5.2.0"; NSString *num2 = @"5.3.0";
if ([num1 compare:num2 options:NSNumericSearch] ==NSOrderedDescending){
ULog(@"%@ is bigger",num1);
}else{
ULog(@"%@ is bigger",num2);
}
解释:
NSOrderedDescending是降序,如果numb1>numb2用这个函数相比较那么就等于降序。
- 顶
- 0
时间: 2024-10-19 02:02:11