不区分大小写的比较NSString
问题描述:
任何人都可以向我指出有关Objective C中不区分大小写的比较的任何资源吗?它似乎没有等效的方法 str1.equalsIgnoreCase(str2)
Can anyone point me to any resources about case insensitive comparison in Objective C? It doesn't seem to have an equivalent method to str1.equalsIgnoreCase(str2)
答
if( [@"Some String" caseInsensitiveCompare:@"some string"] == NSOrderedSame ) {
// strings are equal except for possibly case
}
文档位于搜索和比较方法