NSNumericSearch 比较

来源:互联网 发布:淘宝商城 天猫 编辑:程序博客网 时间:2024/05/16 05:27

 NSNumericSearch 在比较系统版本是经常遇到的一个方法
NSString *string1 = @"5.0.2";
NSString *string2 = @"5.1.3";

#define SYSTEM_VERSION_EQUAL_TO(v)          
        ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)


文档

NSNumericSearch
Numbers within strings are compared using numeric value, that is, Name2.txt < Name7.txt < Name25.txt.
This option only applies to compare methods, not find.

原创粉丝点击