int del_sub_str(char *input_str, char *sub_str, char *output_str)
{
char *input_str_p = input_str;
char *sub_str_p = sub_str;
char *output_str_p = output_str;
int sub_str_index = 0;
int i,j;
int found;
int sub_str_count = 0;
if ((input_str == NULL) || (sub_str == NULL) || (output_str == NULL)) {
return -1;
}
while (*input_str_p != '\0') {
found = 1;
i = 0;
/*如果sub_str_ip + i等于'\0'表示匹配到一个子串*/
while (*(sub_str_p + i) != '\0') {
if (*(input_str_p + i) == *(sub_str_p + i)) {
i++;
} else {
found = 0;
break;
}
}
if (found) {
input_str_p += i;
sub_str_count++;
}
/*拷贝字符*/
*output_str_p++ = *input_str_p++;
}
return sub_str_count;
}