Tuesday, June 14, 2011

Xcode – String contains string in objective-c

How to search sub string 

NSString *string = @"iPhone Application Development";
if ([string rangeOfString:@"iPhone"].location == NSNotFound
{
  NSLog(@"String does not contain iPhone");
} 
else 
{
  NSLog(@"String contains iPhone!");
}

No comments:

Post a Comment

Kamleshwar