Two functions which remove selected characters
void delchar(char* str, char ch)
{
if(str == 0 || *str == 0) return;
char* ptr = str;
while(*ptr != 0) if(*ptr == ch) break; else ptr++;
while(1)
{
char c = *ptr;
*ptr = ptr[1];
ptr[1] = c;
if(*ptr == 0) return; else ptr++;
}
}
void delallchar(char* str, char ch)
{
if(str == 0 || *str == 0) return;
char* ptr = str;
while(*ptr != 0)
{
if(*ptr == ch)
{
char* cstr = ptr;
while(1)
{
char c = *cstr;
*cstr = cstr[1];
cstr[1] = c;
if(*cstr++ == 0) break;
}
continue;
}
ptr++;
}
}
Comments