示例代码:
NSString* v1 = @"3.1.1";
NSString* v2 = @"3.1.2.5.4";
if ([v1 compare:v2 options:NSNumericSearch] == NSOrderedDescending) {
NSLog(@"%@ is greater than %@",v1,v2);
}
Run Code Online (Sandbox Code Playgroud)
从Apple文档中比较和排序字符串.
| 归档时间: |
|
| 查看次数: |
3233 次 |
| 最近记录: |