我有一个长字符串,其中包含文本框中所有"输入的单词"的运行列表.我希望能够针对一个单词字符串检查长字符串,以查看长字符串是否包含短字符串中的单词.
有任何想法吗?
我已经尝试了这个和其他一些东西,其中newString是长字符串,currentTextrightnow是短字符串.
textRange =[newString rangeOfString:currentTextrightnow];
NSLog(@"currenttextright now is %@", currentTextrightnow);
if(textRange.location != NSNotFound)
{
NSLog(@"Does contatin the substring");
}
Run Code Online (Sandbox Code Playgroud)