I'm just playing around with Xcode, and now using Xcode to find some string in another string. And problem here is that it doesn't show what I expect. (It shows "No match found!") Any tips, please? Thanks,
And my code is :
int main(int argc, const char * argv[])
{
@autoreleasepool {
NSString *listOfNames = @"huhuWARDdsfadfadsfsadfafsfsadfafr";
NSString *capListOfNames = [listOfNames capitalizedString];
NSString *name = @"WaRd";
NSString *capName = [name capitalizedString];
NSRange match = [capListOfNames rangeOfString:capName];
if (match.location == NSNotFound)
{
NSLog(@"No match faound!");
}else{
NSLog(@"Found!");
NSLog(@"location : %d",(int)match.location);
NSLog(@"length : %d",(int)match.length);
}
}
return 0;
}