c++ string lowercase code example
Example 1: how to compare lower case character to uppercase cpp
for(int i=0;i<str.size();i++){
int c = str[i];
if (islower(c))
str[i] = toupper(c);
}
Example 2: check if character in string is uppercase c++
if (isupper(str[i])) {
}
Example 3: convert whole string to lowercase c++
#include<bits/stdc++.h>
using namespace std;
main() {
string s = "Viet Nam";
transform(s.begin(), s.end(), s.begin(), ::tolower);
cout << s << endl;
}
Example 4: c++ string functions lowercase
transform(su.begin(), su.end(), su.begin(), ::toupper);
transform(sl.begin(), sl.end(), sl.begin(), ::tolower);