字符串中单词首字母大写,字符大小写转换并过滤非字符

上传人:第*** 文档编号:33582043 上传时间:2018-02-15 格式:DOC 页数:6 大小:41.50KB
返回 下载 相关 举报
字符串中单词首字母大写,字符大小写转换并过滤非字符_第1页
第1页 / 共6页
字符串中单词首字母大写,字符大小写转换并过滤非字符_第2页
第2页 / 共6页
字符串中单词首字母大写,字符大小写转换并过滤非字符_第3页
第3页 / 共6页
字符串中单词首字母大写,字符大小写转换并过滤非字符_第4页
第4页 / 共6页
字符串中单词首字母大写,字符大小写转换并过滤非字符_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《字符串中单词首字母大写,字符大小写转换并过滤非字符》由会员分享,可在线阅读,更多相关《字符串中单词首字母大写,字符大小写转换并过滤非字符(6页珍藏版)》请在金锄头文库上搜索。

1、 =这里有三个大小写转换=1. 给定一个字符串,这个字符串由一连串的单词组成,单词由字母和数字组成,以空格隔开。编程实现:将单词的首字母变成大写,其余变成小写;将单词之间的空格去掉。实例:输入:this is the 1th class结果:“ThisIsThe1thClass”=针对首字母的处理,前面有空格的小写字母改换为大写字母,并把空格忽略掉。=#include #include #include void text13(char *inputStr, int lInputLen, char *outputStr)int len=0;int i=0;int j=0;char tmp=0;

2、if(inputStr=NULL | outputStr=NULL) /输入参数有效性判断outputStr=NULL;return;len=strlen(inputStr);if(lenlInputLen | len9 & *(inputStr+i)z) outputStr=NULL;return;for(i=0; i=a & *(inputStr+i)0 & *(inputStr+i-1)= & *(inputStr+i)=a & *(inputStr+i)#include #include void translate(char *p)char *tmp=NULL;int i=0;int

3、 len=0;int j=0;if(p=NULL) /输入参数有效性判断 return;tmp=p; /该指针指向输入参数len=strlen(p);for(i=0; iZ & *(tmp+i)z)continue; /过滤不符合条件的字符 ,j 控制输出字符的存放位置elseif(*(tmp+i)=A & *(tmp+i)#include #include int toChangeChar(char *str, int lenth, char *des)int len=0;int len2=0;int i=0;int j=0;if(str=NULL | des=NULL) /输入参数的有效性判断des=NULL;return -1;len=strlen(str);if(lenlenth | len=a & *(str+i)=A & *(str+i)len | len2len)printf(The result is errno. n);return 1;printf(Result is : %s n,outputStr);return 0;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号