isalpha和isdigit和isupper和islower

简介: 原型:int isalpha(int ch) (另外的俩个函数格式和这个一样) 用法:头文件加入#include (C语言使用 功能:判断字符ch是否为英文字母,当ch为英文字母a-z或A-Z时,在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,返回非零值( 不一定是1),否则返回零。

原型:int isalpha(int ch) (另外的俩个函数格式和这个一样)

用法:头文件加入#include <cctype>(C语言使用<ctype.h>

功能:判断字符ch是否为英文字母,当ch为英文字母a-z或A-Z时,在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,返回非零值(

不一定是1),否则返回零。

#include<stdio.h>
#include<ctype.h>//string.h不行
#include <conio.h>//getch()
int main()
{
    char ch='K';
    printf("%d\n",isalpha(ch));//返回一个非零值,不确定 ,alpha是希腊的第一个字母
    getch();
}

 

isdigit   
原型:extern int isdigit(char c);   
用法:#include <ctype.h>   
功能:判断字符c是否为数字   
说明:当c为数字

0-9时,返回非零值,否则返回零。   
附加说明 此为宏定义,非真正函数。

目录
相关文章
|
2天前
|
C++
大小写转换——islower/isupper或者tolwer/toupper函数的用法
大小写转换——islower/isupper或者tolwer/toupper函数的用法
|
2月前
rstrip()
rstrip()
12 0
|
8月前
strstr的学习与使用及实现/查找字符串中的字符
strstr的学习与使用及实现/查找字符串中的字符
35 0
|
4月前
|
C语言
深入理解字符串函数和字符函数(islower和isupper、tolower和toupper、strlen、strcpy、strcat、strcmp)(一)
深入理解字符串函数和字符函数(islower和isupper、tolower和toupper、strlen、strcpy、strcat、strcmp)(一)
|
6月前
|
Python
python3中,len()、isalpha()、isspace()、isdigit()、isalnum()实例
# 实例:使用while循环 ```python import string s1 = input('请输入一个字符串:\n') letters = 0 space = 0 digit = 0 others = 0 i = 0 while i < len(s1):     c = s1[i]     i += 1     if c.isalpha():         letters += 1     elif c.isspace():         space += 1     elif c.isdigit():         digit += 1   
19 0
|
10月前
字符串截取
字符串截取
35 0
|
10月前
字符串函数strncmp
字符串函数strncmp
90 1
|
应用服务中间件 nginx C语言
大小写转换还能这样写?
大小写转换还能这样写?
116 1
大小写转换还能这样写?
409. 最长回文串 Longest Palindrome
409. 最长回文串 Longest Palindrome
|
算法 Java C语言
字符串——28. 实现 strStr()
本专栏按照数组—链表—哈希—字符串—栈与队列—二叉树—回溯—贪心—动态规划—单调栈的顺序刷题,采用代码随想录所给的刷题顺序,一个正确的刷题顺序对算法学习是非常重要的,希望对大家有帮助