字符串首字母置为大写
来源:互联网 发布:黑马程序员的简历 编辑:程序博客网 时间:2024/05/16 04:39
字符串首字母置为大写,比如hello you are my sunshine !
变为Hello You Are My Sunshine !
源代码如下:
#include <iostream>#include <cctype>#include <string>using namespace std;void first_letter(string &);int main(){string str = "hello you are my sunshine !";first_letter(str);cout<<"The output string is :"<<str<<endl;system("pause");return 0;}void first_letter(string & s){string::iterator it = s.begin();bool flag = true;while (it!=s.end()){if (isalpha(*it) && flag){*it = toupper(*it);flag = false;}if (isspace(*it)){flag = true;}it++;}}结果如下:
0 0
- 字符串首字母置为大写
- 字符串首字母替换为大写。
- Java 将字符串首字母转换为大写
- golang字符串首字母转化为大写
- 字符串、单词首字母转化为大写
- 字符串首字母大写
- 字符串单词首字母大写
- C#字符串首字母大写
- 字符串首字母大写
- js 字符串首字母大写
- 字符串首字母大写
- 字符串首字母转大写
- String字符串首字母大写
- 将字符串首字母大写
- js-字符串首字母大写
- Bailian2690 首字母大写【字符串】
- 把字符串中所有单词首字母转换为大写
- string 字符串首字母转换为大写&&数组基本操作
- 查找数据库中数据表。。。
- SVN利用钩子中的post-commit同步版本库到网站目录
- 重新开始战斗10-编程之美-寻找发帖水王
- 当官的
- Hibernate 多对多关联关系 中间表有多个字段如何配置
- 字符串首字母置为大写
- 施工方等会改
- 改善C#编程的50个建议(11-15)
- 愿意u六角恐龙
- AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@37773777) LogAbandoned: t
- 系统调用和c库之间的关系
- U盘文件打不开了还能恢复吗
- C++ 容器及选用总结
- POJ 2398 点在凸四边形内的判断(叉积+二分)