1、替换字符串中某个字符的函数#include
char * CharReplace(char * src,char oldChar,char newChar)
{
char * head=src;
while(*src!='\0'){
if(*src==oldChar) *src=newChar;
src++;
}
return head;
}main()
{
char s[]="21~31~41";
char * p=s;
p=CharReplace(s,'~',',');
printf("%s\n",p);
}
阅读(808) | 评论(0) | 转发(0) |