How do convert a string to lowercase except for the first characters in C++? Can this be completed with STL?
Thanks
std::transform(words.begin(), words.end(), words.begin(), ::tolower);
How do convert a string to lowercase except for the first characters in C++? Can this be completed with STL?
Thanks
std::transform(words.begin(), words.end(), words.begin(), ::tolower);
You can just transform [1:n] character, and do not change the first character. Code like this:
#include <iostream>
#include <string>
#include <algorithm> // transform
using namespace std;
int main()
{
string str = "FbcdADcdeFDde!@234";
transform(str.begin()+1, str.end(), str.begin()+1, ::tolower);
cout << str << endl;
return 0;
}