//search create a hash table ,ASII 256, int htable[256]
void DeleteSpecialChars(const char *pSrc, const char *pDel)
{
if(NULL==pSrc || NULL == pDel)
return;
int htable[256];
memset(htable, 0, 256);
while(*pDel!='\0')
{
htable[*pDel]++;
pDel++;
}
char *pSlow = pSrc;
char *pFast = pSrc;
while(pFast!='\0')
{
if(htable[*pFast]!=1)
{
pSlow = pFast;
pSlow++;
}
pFast++;
}
*pSlow='\0';
}
No comments:
Post a Comment