C语言 isupper() 函数—测试字符是否为大写英文字母

文本转自:http://see.xidian.edu.cn/cpp/html/122.html

相关函数 isalpha, islower
头文件 #include <ctype.h>
定义函数 int isupper(int c);
函数说明检查参数 c 是否为大写英文字母.
返回值若参数c 为大写英文字母, 则返回TRUE, 否则返回NULL(0).
附加说明此为宏定义, 非真正函数.
范例 /*找出字符串str 中为大写英文字母的字符 */
#include <ctype.h>
main()
{
char str[] = "123c@#FDsP[e?";
int i;
for(i = 0; str[i] != 0; i++)
if(isupper(str[i]))
printf("%c is an uppercase character\n", str[i]);
}
执行 F is an uppercase character
D is an uppercase character
P is an uppercase character 

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