C语言 判断字符的大小写 isalpha()函数
来源:互联网 发布:ubuntu openstack安装 编辑:程序博客网 时间:2024/04/29 05:43
基本信息
isalpha
<cctype>旧版本的编译器使用
判断字符c是否为大写英文字母
此为宏定义,非真正函数
extern int isupper(int c);
参数c为大写,返回非零值
函数:isalpha
原型:int isalpha(int ch)
用法:头文件加入#include <cctype>(C语言使用<ctype.h>)
功能:判断字符ch是否为英文字母,当ch为英文字母a-z或A-Z时,在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,返回非零值(不一定是1),否则返回零。
PS:{
isupper
原型:extern int isupper(int c);
头文件:<cctype>(旧版本的编译器使用<ctype.h>)
功能:判断字符c是否为大写英文字母
说明:当参数c为大写英文字母(A-Z)时,返回非零值,否则返回零。
附加说明: 此为宏定义,非真正函数。
islower
islower(测试字符是否为小写字母)
相关函数
isalpha,isupper
表头文件
#include<cctype>(旧版本的编译器使用<ctype.h>)
定义函数
int islower(int c)
函数说明
检查参数c是否为小写英文字母。
返回值
若参数c为小写英文字母,则返回TRUE,否则返回NULL(0)。
附加说明:此为宏定义,非真正函数。
}
示例:
/*本函数运行环境Visual C++ 6.0,测试结果 :通过*/
#include<ctype.h>
#include<stdio.h>
int main(void)
{
char ch;
int total;
total=0;//初始化
/*统计字母块*/
do
{
ch=getchar();
if(isalpha(ch)!=0)
total++;
}while(ch!='.');//结束符号为 .
printf("The total of letters is %d \n",total);
return 0;
}
/*运行结果*/
输入:123456我am侯云江.
输出:The total of letters is 2
原型:int isalpha(int ch)
用法:头文件加入#include <cctype>(C语言使用<ctype.h>)
功能:判断字符ch是否为英文字母,当ch为英文字母a-z或A-Z时,在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,返回非零值(不一定是1),否则返回零。
PS:{
isupper
原型:extern int isupper(int c);
头文件:<cctype>(旧版本的编译器使用<ctype.h>)
功能:判断字符c是否为大写英文字母
说明:当参数c为大写英文字母(A-Z)时,返回非零值,否则返回零。
附加说明: 此为宏定义,非真正函数。
islower
islower(测试字符是否为小写字母)
相关函数
isalpha,isupper
表头文件
#include<cctype>(旧版本的编译器使用<ctype.h>)
定义函数
int islower(int c)
函数说明
检查参数c是否为小写英文字母。
返回值
若参数c为小写英文字母,则返回TRUE,否则返回NULL(0)。
附加说明:此为宏定义,非真正函数。
}
示例:
/*本函数运行环境Visual C++ 6.0,测试结果 :通过*/
#include<ctype.h>
#include<stdio.h>
int main(void)
{
char ch;
int total;
total=0;//初始化
/*统计字母块*/
do
{
ch=getchar();
if(isalpha(ch)!=0)
total++;
}while(ch!='.');//结束符号为 .
printf("The total of letters is %d \n",total);
return 0;
}
/*运行结果*/
输入:123456我am侯云江.
输出:The total of letters is 2
0 0
- C语言 判断字符的大小写 isalpha()函数
- isalpha函数,判断字符是否是字母
- C++/C语言函数:isalpha()函数
- C++/C语言函数:isalpha()函数
- C语言 - 自定义大小写字符转换函数的实现
- C语言字符检测函数:isalnum、isalpha、isascii、iscntrl、isdigit、isgraph、islower、isspace、ispunct、isupper
- Python的isalpha()函数判断是否中英文
- isalpha判断字母函数的使用
- C++/C语言函数:isalpha()函数 isdigit(int c)宏
- c语言 字符大小写的转换
- C语言字符判断、大小写互转(五)
- c语言中的isalpha,isdigit,islower,isupper等一系列函数
- C语言中的isalpha,isdigit,islower,isupper等一系列函数
- c语言中的isalpha,isdigit,islower,isupper等一系列函数
- C语言strcasecmp()函数:判断字符串是否相等(忽略大小写)
- isalpha ( )【C语言库函数源代码】
- (c语言)字符的大小写字母的转化
- 用isalpha函数来判断一个字符串中的字符是否是字母
- redirect与dispatcher
- Preference源码包浅析
- Mac OS X 密碼忘記沒關係!教你如何重置密碼
- Uva-1349-Optimal Bus Route Design
- 如何获取浏览器上次的会话数据(session)
- C语言 判断字符的大小写 isalpha()函数
- mysql 根据字段删除重复记录
- 3.Socket单向通信--客户端
- jQuery 书籍推荐
- 993 - Product of digits(贪心)
- PB控件属性之ScrollBar、TrackBar和ProgressBar
- Binary Tree Preorder Traversal
- android aidl进程间的通讯(笔记)
- 轻量级C++程序运行环境搭建 DEV C++