C语言 islower() 函数—测试字符是否为小写字母

转自:http://see.xidian.edu.cn/cpp/html/118.html

相关函数 isalpha, isupper
头文件 #include <ctype.h>
定义函数 int islower(int c);
函数说明检查参数 c 是否为小写英文字母.
返回值若参数c 为小写英文字母, 则返回TRUE, 否则返回NULL(0).
附加说明此为宏定义, 非真正函数.
范例 /* 判断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 

posted @ 2012-03-02 14:36  学习从博客园开始  Views(420)  Comments(0)    收藏  举报