简单实现ReplaceAll(转)
int GetFindStrCount(char* src, char* find) { int count = 0; char* position =src; int findLen = strlen(find); while((position = strstr(position, find)) != NULL) { count++; position = position + findLen; } return count; } /************************************************************************/ /* @param src 要替换的字符串 /* @param des 替换后的字符串存放 /* @param find 所要替换的字符串 /* @param replaceWith 要替换的字符串 /************************************************************************/ char* ReplaceAll(char* src,char *des, char* find, char* replaceWith) { //如果find或者replace为null,则返回和src一样的字符串。 if(find == NULL ||