App登录签名数组排序-数组NSArray根据ASCII码小到大排序

对比字段然后排序,正常很多App登录的涉及到的签名模式基本就一种,这是签名模式的前奏


NSArray* array = [[NSArrayalloc]initWithObjects:@"Nonce",@"DeviceId",@"LicenseNo",@"AppVersion",nil];

NSStringCompareOptions comparisonOptions =NSCaseInsensitiveSearch|NSNumericSearch|

NSWidthInsensitiveSearch|NSForcedOrderingSearch;

NSComparator sort = ^(NSString*obj1,NSString*obj2){

NSRange range =NSMakeRange(0,obj1.length);

return[obj1compare:obj2options:comparisonOptionsrange:range];

};

NSArray*resultArray2= [arraysortedArrayUsingComparator:sort];


NSLog(@"字符串数组排序结果%@",resultArray2);

你可能感兴趣的:(App登录签名数组排序-数组NSArray根据ASCII码小到大排序)