則刪除之後的第一個字符串變成”Thy r stdnts.”。
代碼:
void DeleteString(char *str,char *des)
{
int phash[256]={0};
while(*des!='\0')
{
phash[*des]=1;
des++;
}
char *s=str;
char *f=str;
while(*f!='\0')
{
if(phash[*f]!=1)
{
*s=*f;
s++;
}
f++;
}
*s='\0';
}