#include <string>
#include <algorithm>
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
string strA = "haoyuxinandYANGYUJIA";
printf("Before transform:\n");
printf("strA:%s \n", strA.c_str());
transform(strA.begin(), strA.end(), strA.begin(), ::toupper);
printf("After transform to toupper:\n");
printf("strA:%s \n", strA.c_str());
transform(strA.begin(), strA.end(), strA.begin(), ::tolower);
printf("After transform to lower:\n");
printf("strA:%s \n", strA.c_str());
return 0;
}
C++ string的大小写转换
最新推荐文章于 2023-03-09 09:21:41 发布