C++ iswlower()

The iswlower() function in C++ checks if the given wide character is a lowercase character or not.

The iswlower() function is defined in <cwctype> header file.

iswlower() prototype

int iswlower(wint_t ch);

The iswlower() function checks if ch is a lowercase character i.e one of the following

a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z.

iswlower() Parameters

  • ch: The wide character to check.

iswlower() Return value

  • The iswlower() function returns non zero value if ch is a lowercase character.
  • It returns zero if ch is not a lowercase character.

Example: How iswlower() function works?

#include <cwctype>
#include <iostream>
#include <clocale>
using namespace std;

int main()
{
	setlocale(LC_ALL, "en_US.UTF-8");

	wchar_t ch1 = L'\u03a0';
	wchar_t ch2 = L'\u03c0';

	wcout << L"islower(" << ch1 << ") returned " << boolalpha << (bool)iswlower(ch1) << endl;
	wcout << L"islower(" << ch2 << ") returned " << boolalpha << (bool)iswlower(ch2) << endl;

	return 0;
}

When you run the program, the output will be:

islower(Π) returned false
islower(π) returned true