您的位置:首页 > 其它

判断字符是否为字母,数字,小写字母,大写字母及大小写转化的函数

2019-07-31 00:34 2056 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/weixin_44668898/article/details/97837316

1、判断字符是否为数字

        头文件:(C)#include <ctype.h>    (C++) #include < cctype>

        isdigit()函数:若是则返回true,否则返回false

2、判断字符是否为字母

        头文件:(C)#include <ctype.h>    (C++) #include < cctype>

        isalpha()函数:若是则返回true,否则返回false

3、判断字符是否为大写字母

        头文件:(C)#include <ctype.h>    (C++) #include < cctype>

        isupper()函数:若是则返回true,否则返回false

4、判断字符是否为小写字母

        头文件:(C)#include <ctype.h>    (C++) #include < cctype>

        islower()函数:若是则返回true,否则返回false

5、大写字母转化为小写字母

        头文件:(C)#include <ctype.h>    (C++)#include < cctype>

        tolower()函数

6、小写字母转化为大写字母

        头文件:(C)#include <ctype.h>    (C++)#include < cctype>

        toupper()函数


经过测试,如果不包含头文件< cctype>仅仅有< iostream>也是可以的

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐