太感谢这位大牛啦,原文链接http://ilewen.com/questions/1154
NSUInteger cnt = 0, length = [str length];
NSRange range = NSMakeRange(0, length);
while(range.location != NSNotFound)
{
range = [str rangeOfString: @"substr" options:0 range:range];
if(range.location != NSNotFound)
{
range = NSMakeRange(range.location + range.length, length - (range.location + range.length));
cnt++;
}
}