----------------------------------
/*
統計文章*pt中英文字母得數量*pNum
空格數*pNumSpace,總字數*pNumAll
返回1成功,0失敗
*/
int
Statistic(char*
pt,int
*pNum,int
*pNumSpace,int
*pNumAll)
{
char*
pcur=pt;
*pNum=*pNumSpace=*pNumAll=0;
while(*pcur!='\0')
{
if((*pcur>0x40&&*pcur<0x5B)||(*pcur>0x60&&*pcur<0x7B))*pNum++;
if(*pcur==0x20)*pNumSpace++;
pNumAll++;
pcur++;
}
return
1;
}
/*
統計某壹字符串*p在文章*pt中出現得次數,
返回次數
*/
int
GetTime(char*
pt,char*
p)
{
char
*a=pt,*temp=a,*b=p;
int
num,isok=0;
while(*a!='\0')
{
while(*b!='\0')
{
temp=a;
b=p;
if(*(temp++)==*(b++))
isok=1;
else
isok=0;
}
if(isok)num++;
a++;
}
return
num;
}
/*
刪除*pt中第壹次出現的字串*p
成功返回1,否則0
*/
int
DelString(*pt,*p)
{
char
*a=pt,*temp=a,*b=p;
int
num,isok=0;
while(*a!='\0')
{
temp=a;
b=p;
while(*b!='\0')
{
if(*(temp++)==*(b++))
isok=1;
else
isok=0;;
}
if(isok)
{
while(*temp!='\0'&&(*(a++)=*(temp++))
*a='\0';
return
1;
}
a++;
}
return
0;
}