islower() - Character Function
How is "islower()" used in C++?
Explanation
islower() is used to check the function arguments for lowercase letters (a-z). It returns zero if lowercase letters (a-z) are not found.
Syntax:
int islower( int c );
Example :
#include <stdio.h> #include <ctype.h> int main() { int n; int count =0; char str[]="aAaasadaZZZ"; for ( n=0 ; str[n]!=' ' ; n++) { if(islower(str[n])!=0) { count++; } } printf ("The string has %d lower-case characters.\n", count); return 0; } |
Result :
The string has 7 lower-case characters.
In the above example, this function is used to check the lowercase letters (a-z) in the array "str". The checking is based on the ASCII values.