C++ Standard Library C++ STL Library

C++ <cctype> - islower() Function



The C++ <cctype> islower() function is used to check if the given 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 characters as lowercase characters.

Syntax

int islower ( int ch );               

Parameters

ch Specify the character to be checked, casted to an int, or EOF.

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 islower() function.

#include <iostream>
#include <cctype>
using namespace std;
 
int main (){
  char str[50] = "99HEllo";

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

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

The output of the above code will be:

99HEllo contains 3 lowercase letters.

❮ C++ <cctype> Library