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);
}
阅读(643) | 评论(0) | 转发(0) |