字符串替换这里怎么理解
程序代码:
方式一: // 把字符串str中的子字符串substr1用子字符串substr2替换 char* SwapSubstr(char *dest, char *source, char*substr1, char*substr2) { char *pstr = source; char *pstr1 = dest; unsigned int i; for (i=0;i<strlen(source)-strlen(substr1)+1;i++) { if (0==strncmp(pstr,substr1,strlen(substr1))) { strcat(pstr1,substr2); pstr += strlen(substr1); pstr1 += strlen(substr2); } else *pstr1++ = *pstr++; } *pstr1 = 0; return dest; }
这里*pstr1 = 0;和return dest;这里看不懂