C语言字符串替换函数(strrpl)
来源:互联网 发布:java excel报表工具 编辑:程序博客网 时间:2024/05/16 15:14
http://blog.csdn.net/sunnysab/article/details/24379989
- // 参数说明:
- // in, 源字符串
- // out, 存放最后结果的字符串
- // outlen,out最大的大小
- // src,要替换的字符串
- // dst,替换成什么字符串
- char *strrpl(char *in, char *out, int outlen, const char *src, char *dst)
- {
- char *p = in;
- unsigned int len = outlen - 1;
- // 这几段检查参数合法性
- if((NULL == src) || (NULL == dst) || (NULL == in) || (NULL == out))
- {
- return NULL;
- }
- if((strcmp(in, "") == 0) || (strcmp(src, "") == 0))
- {
- return NULL;
- }
- if(outlen <= 0)
- {
- return NULL;
- }
- while((*p != '\0') && (len > 0))
- {
- if(strncmp(p, src, strlen(src)) != 0)
- {
- int n = strlen(out);
- out[n] = *p;
- out[n + 1] = '\0';
- p++;
- len--;
- }
- else
- {
- strcat_s(out, outlen, dst);
- p += strlen(src);
- len -= strlen(dst);
- }
- }
- return out;
- }
0 0
- [原]C语言字符串替换函数(strrpl)
- C语言字符串替换函数(strrpl)
- C语言字符串替换函数
- c语言中的字符串替换函数
- C语言实现字符串替换函数
- C语言实现字符串替换函数
- C语言字符串替换函数,字符串插入函数的实现
- C语言 字符串替换
- C语言替换字符串
- 字符串替换C语言
- c语言字符串替换
- C字符串替换函数
- 自己实现的C 语言的字符串替换函数
- 自己实现的C 语言的字符串替换函数
- 【C语言】字符串替换空格:实现一个函数,把字符串里的空格替换成“%20”
- C语言实现字符串替换
- C语言 字符串替换 多次
- C语言实现字符串替换
- eval 用法 matlab
- 求助:利用级联器进行人脸检测和人眼检测出现的问题
- PHP+mysql+Highcharts实现饼状统计图
- 调教一下你的matlab,给等待加入一段waitbar
- 1、Strategy策略模式
- C语言字符串替换函数(strrpl)
- 播放器大测评
- linux 设置环境变量的方法
- [USACO Jan09]安全路径Safe Travel解题报告
- Longest Consecutive Sequence
- 【剑指Offer学习】【面试题25:二叉树中和为某一值的路径】
- LeetCode71 Simplify Path java题解
- objc写一个NSMutableArray不连续索引替换对象的方法
- 微信java开发(nat123配制本地环境)