NSString *tmpStr = [[NSString alloc] initWithString:@"abcdefg"];
NSRange range;
range = [tmpStr rangeOfString:@"a"];
if (range.location != NSNotFound) {
NSLog(@"found at location = %d, length = %d",range.location,range.length);
}else{
NSLog(@"Not Found");
}
更多阅读请访问:http://www.hopean.com