标签:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString *str=[[NSString alloc]initWithString:@"a"];
NSString *str2=[[NSString alloc]initWithString:@"A"];
//字符串声明 创建对象
NSComparisonResult result=[str compare:str2];
//NSComparisonResult result1=[str caseInsensitiveCompare:str1];
if (result==NSOrderedAscending) {
NSLog(@"str<str1");
}
else if (result==NSOrderedDescending){
NSLog(@"str<str2");
}
else
{
NSLog(@"str=str1");
}
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/haitong-0311/p/5120346.html