//使用递归,好理解.当然,如果你要更高效的方法,自已去研究模式匹配吧!!!
int substr_time(const char *s,const char *f)
{
static int i = 0;
if (strlen(s)>=strlen(f))
{
if (!strncmp(s,f,strlen(f)))
{
i++;
substr_time(s+strlen(f),f);
}
else
substr_time(s+1,f);
}
else
return i;
}
[
本帖最后由 zjl138 于 2008-5-21 22:34 编辑 ]