isxdigit
描述 (Description)
它检查字符是否为十六进制数字。
声明 (Declaration)
以下是std :: isxdigit的声明。
C++98
int isxdigit ( int c );
C++11
int isxdigit ( int c );
参数 (Parameters)
c - 要检查的字符,转换为int或EOF。
返回值 (Return Value)
它返回一个不等于零的值。
异常 (Exceptions)
No-throw guarantee - 此函数永远不会抛出异常。
例子 (Example)
在下面的示例中为std :: isxdigit。
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main () {
char str[]="ffff";
long int number;
if (isxdigit(str[0])) {
number = strtol (str,NULL,16);
printf ("The hexadecimal number %lx is %ld.\n",number,number);
}
return 0;
}
样本输出应该是这样的 -
The hexadecimal number ffff is 65535.