2012年5月4日
摘要: c语言没有像java那么丰富的字符串操作函数,很多有用的函数得自己写,搞了一天,写了几个常用函数,留着以后有用。[cpp]view plaincopy#include<string.h>#include<stdio.h>/*将str1字符串中第一次出现的str2字符串替换成str3*/voidreplaceFirst(char*str1,char*str2,char*str3){charstr4[strlen(str1)+1];char*p;strcpy(str4,str1);if((p=strstr(str1,str2))!=NULL)/*p指向str2在str1中第 阅读全文
posted @ 2012-05-04 17:31 一个人的天空@ 阅读(18554) 评论(0) 推荐(1) 编辑