C++ Standard Library C++ STL Library

C++ <cwctype> - iswlower() Function



The C++ <cwctype> iswlower() function is used to check if the given wide character is a lowercase letter. In the default "C" locale, the following are the lowercase letters: abcdefghijklmnopqrstuvwxyz. Other locales may consider a different selection of wide characters as lowercase letters.

Syntax

int iswlower ( wint_t ch );               

Parameters

ch Specify the wide character to be checked, casted to an wint_t, or WEOF.

Return Value

Returns non-zero value (i.e, true) if ch is a lowercase letter, else returns zero (i.e, false).

Example:

The example below shows the usage of iswlower() function.

#include <iostream>
#include <cwchar>
#include <cwctype>
using namespace std;
 
int main (){
  wchar_t str[50] = L"99HEllo";

  //counting the number of lowercase
  //wide characters in str
  int i = 0, count = 0;
  while(str[i]) {
    if(iswlower(str[i]))
      count++;
    i++;
  }

  //displaying the output
  wcout<<str<<" contains "<<count<<
       " lowercase letters.";  
  return 0;
}

The output of the above code will be:

99HEllo contains 3 lowercase letters.

❮ C++ <cwctype> Library