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.
This function is used to check if the arguement contains any uppercase letters such as A, B, C, D……….Z.
Syntax int isupper(int x)
Input : A Output : Uppercase
Input : a Output : Not uppercase
This function is used to check if the arguement contains lowercase letters such as a, b, c, d, ……..z.
Syntax int islower(int x)
Input:A Output : Not Lowercase
Input : a Output : Lowercase
Application of islower(), isupper(), tolower(), toupper() function.
Given a string, task is to convert the characters in the string into opposite case, i.e. if a character is in lowercase, we need to convert it into uppercade and vice versa.
Input : GeekS Output :gEEKs Input :Test Case Output :tEST cASE
1. Traverse the given string character by character upto its length, check if character is in lowercase or uppercase using predefined function.
3. If lowercase, convert it to uppercase using toupper() function, if uppercase, convert it to lowercase using tolower() function.
4. Print the final string.
This article is contributed by Ayush Saxena. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- unordered_multimap and its application
- C++ bitset and its application
- is_permutation() in C++ and its application for anagram search
- Oracle Interview | Set 8 (On Campus for Application Developer)
- isspace() in C/C++ and its application to count whitespace characters
- VMware Interview Experience | Set 5 (On-Campus for IT Application Developer)
- Find the minimum number of preprocess moves required to make two strings equal
- Check if the given string is the same as its reflection in a mirror
- Find index i such that prefix of S1 and suffix of S2 till i form a palindrome when concatenated
- Check whether two strings are equivalent or not according to given condition
- Check if a string can be converted to another string by replacing vowels and consonants
- Count of words that are present in all the given sentences
- Minimum replacements to make adjacent characters unequal in a ternary string | Set-2
- Generate a string consisting of characters 'a' and 'b' that satisfy the given conditions