string大小写转换

string大小写转换 源码:

 1 #include <string>
 2 #include <iostream>
 3 #include <algorithm>
 4 using namespace std;
 5 
 6 int main(int argc, char *argv[])
 7 {
 8     string strTemp="aBcD123Ef";
 9     transform(strTemp.begin(), strTemp.end(), strTemp.begin(), ::toupper);//转化为大写 #include <algorithm>
10     cout <<"转化为大写" << strTemp << endl;
11     transform(strTemp.begin(), strTemp.end(), strTemp.begin(), ::tolower);//转化为小写 #include <algorithm>
12     cout <<"转化为小写" << strTemp << endl;
13 
14     cin.get();
15     return 0;
16 }

效果

原文地址:https://www.cnblogs.com/KMould/p/13821279.html