词条 | isxdigit |
释义 | isxdigit(测试字符是否为16进制数字) 相关函数 isalnum,isdigit 表头文件 #include<ctype.h> 定义函数 int isxdigit (int c) 函数说明 检查参数c是否为16进制数字,只要c为下列其中一个情况则返回TRUE。16进制数字:0123456789ABCDEF。 参数类型为int,但是可以直接将char 类型数据传入. 例如:isxdigit('a') 返回为1. 返回值 若参数c为16进制数字,则返回1,否则返回0。 附加说明 此为宏定义,非真正函数。 范例 /*找出字符串str中为十六进制数字的字符*/ #include <ctype.h> #include <stdio.h> int main() { char str[]="123c@#FDsP[e?"; int i; for(i=0;str[i]!='\\0';i++) if(isxdigit(str[i])) printf("%c is a hexadecimal digits\",str[i]); } 执行 1 is a hexadecimal digits 2 is a hexadecimal digits 3 is a hexadecimal digits c is a hexadecimal digits F is a hexadecimal digits D is a hexadecimal digits e is a hexadecimal digits |
随便看 |
百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。