C++ 本地化庫 - isxdigit



描述

它檢查字元是否是十六進位制數字。

宣告

以下是 std::isxdigit 的宣告。

C++98

int isxdigit ( int c );

C++11

int isxdigit ( int c );

引數

c − 要檢查的字元,轉換為 int 型別,或 EOF。

返回值

它返回一個非零值。

異常

無異常保證 − 此函式從不丟擲異常。

示例

以下是 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.
locale.htm
廣告
© . All rights reserved.