function
<cwctype>

iswxdigit

int iswxdigit (wint_t c);
Check if wide character is hexadecimal digit
Checks whether c is a hexadecimal digit character.

A hexadecimal digit is any of: 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

This function is the wide-character equivalent of isxdigit (<cctype>): If c translates with wctob to a character for which isxdigit is true, it is always considered a hexadecimal digit character by this function too.

In C++, a locale-specific template version of this function (isxdigit) exists in header <locale> for all character types.

Parameters

c
Wide character to be checked, casted to a wint_t, or WEOF.
wint_t is an integral type.

Return Value

A value different from zero (i.e., true) if indeed c is a hexadecimal digit. Zero (i.e., false) otherwise.

Example

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;
}

Output:
The hexadecimal number ffff is 65535.


See also