函式
<cwctype>

iswxdigit

int iswxdigit (wint_t c);
檢查寬字元是否為十六進位制數字
檢查c是否為十六進位制數字字元

一個十六進位制數字是以下任意一個:0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

此函式是isxdigit<cctype>)的寬字元等價版本:如果c透過wctob轉換為isxdigit為true的字元,那麼此函式也始終將其視為十六進位制數字字元。

在C++中,此函式的本地化特定模板版本(isxdigit)存在於標頭檔案<locale>中,適用於所有字元型別。

引數

c
要檢查的寬字元,強制轉換為wint_t型別,或WEOF.
wint_t 是一個整數型別。

返回值

如果 c 確實是空白字元,則返回一個非零值(即true) 如果c確實是十六進位制數字。零(即false)。

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* isxdigit example */
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
int main ()
{
  wchar_t str[] = L"ffff";
  long int number;
  if (iswxdigit(str[0]))
  {
    number = wcstol (str,NULL,16);
    wprintf (L"The hexadecimal number %lx is %ld.\n",number,number);
  }
  return 0;
}

輸出
The hexadecimal number ffff is 65535.


另見