Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
iswlower() function in C++ STL
In C++ standard template library(STL), iswlower() function is used to check if the given wide character is in lowercase or not, if not then the function will return a zero value. The characters with ASCII value from 97 to 122 i.e. a-z are the lowercase alphabetic letters. Iswlower() function is present in cctype header file in C/C++.
Syntax of iswlower () is as follows
int iswlower (wint_t c)
Parameters − c is a wide character to be checked, casted to a wint_t, or WEOF where wint_t is an integral type.
Return Value − islower() function return non-zero value when the string is in lowercase else it will return a zero value.
For Example
Input − string[] = Test Me
Output − string has lowercase letters
Explanation − in the given string we checked whether it contains lowercase letters between a-z
Input − string[] = Test Me
Output − TEST ME
Explanation − In the given string we converted lowercase characters to the uppercase characters.
Approach used in the below program is as follows
Input the string in a wchar_str type variable
Apply the in-built iswlower() function of STL to check whether the string has lowercase letters or not
If the result is true then the function will return any non-zero value and if the result if false then the function will return zero value.
Display the final result
Example
#include <stdio.h>
#include <wctype.h>
int main (){
int i=0;
wchar_t str[] = L"Test String.\n";
wchar_t c;
while (str[i]){
c = str[i];
if (iswlower(c)) c=towupper(c);
putwchar (c);
i++;
}
return 0;
}
Output
If we run the above code it will generate the following output −
TEST STRING
