借助IOS NSSting 自带的方法 compare: 直接进行比较 即可
1 2 3 4 5 6 7 8 9 |
NSString *num1 = @"2.0.12345.6"; NSString *num2 = @"2.0.2345.6"; if ([num1 compare:num2 options:NSNumericSearch] == NSOrderedDescending) { NSLog(@"%@ is bigger",num1); }else { NSLog(@"%@ is bigger",num2); } |
转载请注明:天狐博客 » iOS中的APP版本号比较方法