C语言isupper()函数:判断字符是否为大写英文字母
头文件:
?
1
|
#include <ctype.h>
|
定义函数:
?
1
|
int isupper ( int c);
|
函数说明:检查参数c是否为大写英文字母。
返回值:若参数c 为大写英文字母,则返回非 0,否则返回 0。
附加说明:此为宏定义,非真正函数。
范例:找出字符串str 中为大写英文字母的字符。
?
1
2
3
4
5
6
7
8
|
#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]);
}
|
执行结果:
?
1
2
3
|
F is an uppercase character
D is an uppercase character
P is an uppercase character
|
C语言islower()函数:判断字符是否为小写字母
头文件:
?
1
|
#include <ctype.h>
|
islower() 用来判断一个字符是否是小写字母,其原型为:
?
1
|
int islower ( int c);
|
【参数】c 为需要检测的字符。
【返回值】若参数c 为小写英文字母,则返回非 0 值,否则返回 0。
注意,此为宏定义,非真正函数。
【实例】判断str 字符串中哪些为小写字母。
?
1
2
3
4
5
6
7
8
|
#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]);
}
|
输出结果:
?
1
2
3
|
c is a lower-case character
s is a lower-case character
e is a lower-case character
|
相关文章
猜你喜欢
- 个人网站搭建:如何挑选具有弹性扩展能力的服务器? 2025-06-10
- 个人服务器网站搭建:如何选择适合自己的建站程序或框架? 2025-06-10
- 64M VPS建站:能否支持高流量网站运行? 2025-06-10
- 64M VPS建站:怎样选择合适的域名和SSL证书? 2025-06-10
- 64M VPS建站:怎样优化以提高网站加载速度? 2025-06-10
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-05-27 47
-
2025-06-04 85
-
2025-05-27 27
-
2025-05-25 85
-
2025-05-29 97
热门评论