![]() |
VOOZH | about |
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 uppercase letters such as A, B, C, D, ..., Z.
Syntax: int isupper(int x)
Not uppercase.
islower() Function: This function is used to check if the argument contains lowercase letters such as a, b, c, d, ..., z.
Syntax: int islower(int x)
Not 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 uppercase and vice versa.
Syntax of tolower(): int tolower(int ch);
Syntax of toupper(): int toupper(int ch);
Examples:
Input : GeekS Output :gEEKs Input :Test Case Output :tEST cASE
Implementation:
gEEKs
Time complexity : O(n)
Auxiliary Space : O(1)