IOS 版本号大小比较
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
做难事必有所得