gpt4 book ai didi

iphone - NSCaseInSensitive在iOS中

转载 作者:行者123 更新时间:2023-12-01 19:15:07 25 4
gpt4 key购买 nike

我正在进行子字符串比较,我这样做是这样

 if ([mystring rangeOfString:string options:NSCaseInsensitiveSearch].location == NSNotFound) {
return NO;
} else {
return YES;
}

但这在与Read和READ比较时不起作用

最佳答案

抱歉,但是您的代码对我有用...如果我在XCode中执行此操作:

if ([@"Read" rangeOfString:@"READ" options:NSCaseInsensitiveSearch].location == NSNotFound) {
NSLog(@"NO!!");
} else {
NSLog(@"YES!!");
}

我得到以下输出:
YES!!

关于iphone - NSCaseInSensitive在iOS中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13856773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com