Is there a way to use if 'contains' instead of isEqual?

This question already has an answer here:

  • How do I check if a string contains another string in Objective-C? 20 answers

  • 希望这对你有所帮助

    if ([cell.lblStatus.text rangeOfString:@"Full"].location != NSNotFound) {
       NSLog(@"Contain");
       cell.lblStatus.backgroundColor = [UIColor redColor];
    } else {
      NSLog(@"No Contain");
      cell.lblStatus.backgroundColor = [UIColor greenColor];
    }
    
    链接地址: http://www.djcxy.com/p/73990.html

    上一篇: iPhone:如何检查字符串中是否存在子字符串?

    下一篇: 如果'包含'而不是isEqual,有没有办法使用?