Conversion of whole String to uppercase or lowercase using STL in C++ Last Updated : 10 Jan, 2023 Comments Improve Suggest changes 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++ J Jatin Goyal Improve Article Tags : Strings Computer Science Fundamentals DSA STL cpp-string C++ Basic Programs C++ String Programs +3 More Practice Tags : STLStrings Similar Reads Case conversion (Lower to Upper and Vice Versa) of a string using BitWise operators in C/C++ Given a string, write a function that converts it either from lower to upper case or from upper to lower case using the bitwise operators &(AND), |(OR), ~(NOT) in place and returns the string. Many of us know that Bitwise manipulations are faster than performing arithmetic operations for a compi 5 min read How to create half of the string in uppercase and the other half in lowercase? The first thing that we have to keep in my mind while solving this kind of problem is that the strings are immutable i.e, If I am taking the following string var string1 = "geeksforgeeks";string1[0] = "G";console.log(string1);As strings are immutable, so we cannot change the character of the string, 9 min read Check string for all uppercase-lowercase or first uppercase and rest lowercase characters Given a string S, the task is to check if all the characters in S are in lowercase, or all the characters are in uppercase or only the first character is in uppercase, and the remaining characters are in lowercase. Print "YES" if any of the condition gets satisfied else print "NO". Examples: Input: 6 min read Convert all lowercase characters to uppercase whose ASCII value is co-prime with k Given an integer 'k' and a string 'str' consisting of characters from English alphabets. The task is to convert all lower case character to uppercase whose ASCII value is co-prime with k. Examples: Input: str = "geeksforgeeks", k = 4 Output: GEEKSfOrGEEKS 'f' and 'r' are the only characters whose AS 6 min read Check if uppercase characters (Capital letters) in a string are used correctly or not | Set 2 Given a string S consisting of uppercase and lowercase letters, the task is to check if uppercase characters are used correctly in the given string or not. Correct usage of uppercase characters are as follows: All characters in the string are in uppercase. For example, âGEEKSâ.None of the characters 5 min read Like