C++:可以利用STL的transform配合toupper/tolower,完成std::string转换大(小)写的功能
#include#include #include #include using namespace std; int main() { string str = "Test"; // toUpper transform(str.begin(), str.end(), str.begin(), ::toupper); // toLower //transform(str.begin(),str.end(),str.begin(), ::tolower); cout << str << endl; }



