c语言islower()函数如何判断字符是否为小写字母?引入的头文件:#include <ctype.h>
定义islower()函数方法:int islower(int c);
islower()函数介绍:检查参数 c 是否为小写英文字母。
islower()函数返回值:若参数c 为小写英文字母,则返回true,否则返回null(0)。
附加说明:此为宏定义,非真正函数。
islower()函数实例:判断str 字符串中哪些为小写字母。
#include <ctype.h> main(){ char str[] = "123@#FDsP[e?"; int i; for(i = 0; str[i] != 0; i++) if(islower(str[i])) printf("%c is a lower-case character\n", str[i]); }
程序实例执行结果:
c is a lower-case character
s is a lower-case character
e is a lower-case character