把字符串A中的所有字符串B的字符都删掉
eg:
A:dadhuiafuf B: ad
A:huiafuf
1 共256个字符 申请256的空间 hash[256]={0};
2 B字符为下标 在hash出现的地方变1 hash[B[i]]=1;
即B有的 做标记 A看到 删掉
3 创建一个指针 为新字符串 *temp=A
遍历hash[A[i]]中 =0 不删 *temp++=*A A++;
=1 删 A++ A动 temp不动
void DeleteStr(char *str1,char *str2)
{
//从str1 中删str2中所有字符
if(str1==NULL||str2==NULL)
return ;
int len1=strlen(str1);
int len2=strlen(str2);
if(len1==0||len2==0)
return ;
//创建hash,hash 中str2的位置变1
hash[256]={0};
for(int i=0;i