字符串转换大小写如下:

 #include "stdafx.h"
#include <iostream>
#include <string> using namespace std; int main()
{
string str = "helloworld";
for (auto begin = str.begin(); begin != str.end(); ++begin)
{
*begin = toupper(*begin);
} cout << str << endl; system("PAUSE");
return ;
}

删除字符串中所有的大写字母:

 #include "stdafx.h"
#include <iostream>
#include <string> using namespace std; int main()
{
string str("helloWorld");
for (auto begin = str.begin(); begin != str.end();)
{
if (isupper(*begin))
{
begin = str.erase(begin);
continue;
}
++begin;
} cout << str << endl; system("PAUSE");
return ;
}

用vector对象初始化string :

 #include "stdafx.h"
#include <iostream>
#include <string>
#include <vector> using namespace std; int main()
{
vector<char> vect;
char arry[] = {'h','e','l','l','o'};
vect.insert(vect.begin(),arry,arry+);
char *pc = new char[vect.size()+];
int i = ;
for (vector<char>::iterator begin = vect.begin(); begin != vect.end(); ++begin)
{
pc[i] = *begin;
++i;
}
pc[vect.size()] = '\0';
string str(pc);
delete [] pc;
cout << str << endl;
system("PAUSE");
return ;
}

最新文章

  1. Sublime Text 3 支持的热门插件推荐
  2. 使用TextUtils.isEmpty简单化代码
  3. 3942: [Usaco2015 Feb]Censoring [KMP]
  4. 【Git】简单地使用github当做远程共享仓库
  5. MySQL中distinct和group by性能比较[转]
  6. 在SQL中使用PL/SQL函数存在的问题
  7. datazen logo修改
  8. sqlite3安装
  9. WM_PAINT在微软官方定义中,wParam和lParam都没有使用,所以就被Delphi给重定义了这个消息,还增加了DC(Delphi可任意改写消息的结构)
  10. java String时间转为时间戳
  11. cs231n spring 2017 lecture9 CNN Architectures 听课笔记
  12. 打印星星 - Python
  13. [luogu P2234] [HNOI2002]营业额统计
  14. windows下boost编译(vs2010)
  15. c/c++ 读入一行不确定个数的整数
  16. 过滤器(Filter)与拦截器(Interceptor)的区别
  17. HashMap分析 + 哈希表
  18. ALGO-1_蓝桥杯_算法训练_区间k大数查询
  19. java study3
  20. 可以方便配合 Git 的现代编辑器

热门文章

  1. 迈向新纪元编辑器Atom
  2. Paxos 实现日志复制同步
  3. Android SVG矢量资源的使用方法
  4. python中关于元组的操作
  5. linux上静态库链接的有关问题
  6. js_DOM操作
  7. Struct 和 Union 的详细区别
  8. [html5] 学习笔记-服务器推送事件
  9. Kafka 0.10 KafkaConsumer流程简述
  10. Mac和Linux系统的:Arp欺骗源码