#include<bits/stdc++.h>
using namespace std;
main() {
string s = "Viet Nam";
transform(s.begin(), s.end(), s.begin(), ::tolower); //lowercase
cout << s << endl;
}
// sl is the string which is converted to lowercase
string sl = "Jatin Goyal";
// using transform() function and ::tolower in STL
transform(sl.begin(), sl.end(), sl.begin(), ::tolower);
transform(s.begin(), s.end(), s.begin(), ::tolower);
#include <iostream>
#include <cctype>
using namespace std;
int main() {
// convert 'A' to lowercase
char ch = tolower('A');
cout << ch;
return 0;
}
// Output: a
Code Example |
---|
Cpp :: c++ call by reference |
Cpp :: detect end of user input cpp |
Cpp :: how to sort a string alphabetically in c++ |
Cpp :: how to delete a file in cpp |
Cpp :: c++ triple |
Cpp :: are strings mutable in c++ |
Cpp :: sort vector in reverse order c++ |
Cpp :: break in c++ |
Cpp :: is power of 2 |
Cpp :: hello world in c++ |
Cpp :: c++ cast to type of variable |
Cpp :: C++ break with for loop |
Cpp :: stoi() c++ |
Cpp :: log in c++ |
Cpp :: inline in class in C++ |
Cpp :: find kth max and min element in an array |
Cpp :: vector to string cpp |
Cpp :: remove element from vector c++ |
Cpp :: c++ do every 1 minutes |
Cpp :: print pattern and space in cpp |
Cpp :: unordered_map contains key |
Cpp :: matrix dynamic memory c++ |
Cpp :: set width qpushbutton |
Cpp :: print hello world c++ |
Cpp :: insert element in array c++ |
Cpp :: inheritance in c++ |
Cpp :: string comparison c++ |
Cpp :: Fisher–Yates shuffle Algorithm c++ |
Cpp :: opencv cpp create single color image |
Cpp :: resharper fold if statement c+ |