XCode How to check if a string contains another string

 NSString *string = @"how to check if a string contains another string";
 if ([string rangeOfString:@"how"].location == NSNotFound) 
{
NSLog(@"Not found");
}
else
{
NSLog(@"Found");
}

0 nhận xét:

Đăng nhận xét