Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想比较 2 个字符串。我这样做是这样的:
[someString isEqualToString:otherString];
但是我有一个问题,当有大写字母但单词相同时,我没有得到“是”的结果。
if( [@"Some String" caseInsensitiveCompare:@"some string"] == NSOrderedSame ) { // strings are equal except for possibly case }
if([[someString uppercaseString] isEqualToString[otherString uppercaseString]])
使用条件如上