Conversion of whole String to uppercase or lowercase using STL in C++ Last Updated : 10 Jan, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report Try it on GfG Practice Given a string, convert the whole string to uppercase or lowercase using STL in C++. Examples: For uppercase conversionInput: s = "String"Output: s = "STRING" For lowercase conversionInput: s = "String"Output: s = "string" Functions used : transform : Performs a transformation on given array/string. toupper(char c): Returns the upper case version of character c. If c is already in uppercase, return c itself. tolower(char c) : Returns lower case version of character c. If c is already in lowercase, return c itself. CPP // C++ program to convert whole string to // uppercase or lowercase using STL. #include<bits/stdc++.h> using namespace std; int main(){ // s1 is the string which is converted to uppercase string s1 = "abcde"; // using transform() function and ::toupper in STL transform(s1.begin(), s1.end(), s1.begin(), ::toupper); cout<<s1<<endl; // s2 is the string which is converted to lowercase string s2 = "WXYZ"; // using transform() function and ::tolower in STL transform(s2.begin(), s2.end(), s2.begin(), ::tolower); cout<<s2<<endl; return 0; } OutputABCDE wxyz Time complexity: O(N) where N is length of string ,as to transform string to Upper/Lower we have to traverse through all letter of string once.Auxiliary Space: O(1) Comment More infoAdvertise with us Next Article Conversion of whole String to uppercase or lowercase using STL in C++ F freaky.ju Improve Article Tags : C++ STL cpp-string C++ Basic Programs C++ String Programs +1 More Practice Tags : CPPSTL Similar Reads Convert String to size_t in C++ To convert String to size_t in C++ we will use stringstream, It associates a string object with a stream allowing you to read from the string as if it were a stream (like cin). We must include the stream header file in order to use stringstream. When parsing input, the stringstream class comes in qu 1 min read ios manipulators nouppercase() function in C++ The nouppercase() method of stream manipulators in C++ is used to clear the showbase format flag for the specified str stream. This flag makes the output operations not to use capital letters instead of lowercase letters. Syntax: ios_base& nouppercase (ios_base& str) Parameters: This method 2 min read ios manipulators uppercase() function in C++ The uppercase() method of stream manipulators in C++ is used to set the uppercase format flag for the specified str stream. This flag makes the output operations to use capital letters instead of lowercase letters. Syntax: ios_base& uppercase (ios_base& str) Parameters: This method accepts s 1 min read isupper() and islower() and their application in C++ In C++, isupper() and islower() are predefined functions used for string and character handling. cstring.h is the header file required for string functions and cctype.h is the headerfile required for character functions. isupper() Function: This function is used to check if the argument contains any 2 min read towupper() function in C/C++ The towupper() is a built-in function in C/C++ which converts the given wide character into uppercase. It is defined within the cwctype header file of C++. Syntax: wint_t towupper( wint_t ch ) Parameter: The function accepts a single mandatory parameter ch which specifies the wide character which we 2 min read Like