字符串替换
来源:互联网 发布:淘宝上比较好的男装店 编辑:程序博客网 时间:2024/05/22 07:08
#include <stdlib.h>#include <string.h>#include "oj.h"#include <iostream>using namespace std;/*功能: 输入: 输出: 返回:成功0,其它-1 */int ProcessString( char * strInput,char chSrc,char chDes ,char * strOutput){ if (NULL == strInput || NULL == strOutput) { return -1; } int flag = 0; int iCur =0; while ('\0' != strInput[iCur]) { if (strInput[iCur] == chSrc) { strOutput[iCur] = chDes; flag = 0; } else { strOutput[iCur] = strInput[iCur]; } iCur ++; } strOutput[iCur] = '\0'; if (1 == flag) { return 0; } else { return -1; }}int main(){ char strInput[] = "d545a"; char strSrc[] = "d545c"; char strOutput[10] = ""; ProcessString(strInput,'a','c',strOutput); cout<<strInput<<endl<<strOutput<<endl; return 0;}
0 0
- 字符串替换
- 字符串替换
- 替换字符串
- 字符串替换
- 替换字符串
- 字符串替换
- 字符串替换
- 字符串替换
- 替换字符串
- 字符串替换
- 字符串替换
- 字符串替换
- 字符串替换
- 字符串替换
- 替换字符串
- 字符串替换
- 字符串替换
- 字符串替换
- iOS 默认英文语言误删除的恢复
- objective C 对象模型
- struts2导出数据到excel中方法(模板方法)
- iOS 开发者必不可少的 75 个工具
- iOS之UITableView的使用—下拉刷新
- 字符串替换
- ceph存储 LINUX下多路径(multi-path)介绍及使用
- 初入three.js
- 2015年,重新开启我的博客之旅.
- BlockingQueue
- eclipse4.4 jadclipse插件
- 用户体验很棒的Git学习网站
- 杂文:批量删除换行符方法
- 教会你如何编写makefile文件