int iswxdigit( wint_t ch );
(since C95)Checks if the given wide character corresponds (if narrowed) to a hexadecimal numeric character, i.e. one of 0123456789abcdefABCDEF
.
Non-zero value if the wide character is a hexadecimal numeric character, zero otherwise.
[edit] Notesiswdigit and iswxdigit
are the only standard wide character classification functions that are not affected by the currently installed C locale.
Some locales offer additional character classes that detect non-ASCII digits
#include <locale.h> #include <stdio.h> #include <wchar.h> #include <wctype.h> void test(wchar_t a3, wchar_t u3, wchar_t j3) { printf("\t '%lc' '%lc' '%lc'\n", a3, u3, j3); printf("iswxdigit: %d %d %d\n", !!iswxdigit(a3), !!iswxdigit(u3), !!iswxdigit(j3)); printf("jdigit: %d %d %d\n", !!iswctype(a3, wctype("jdigit")), !!iswctype(u3, wctype("jdigit")), !!iswctype(j3, wctype("jdigit"))); } int main(void) { wchar_t a3 = L'9'; // the ASCII digit 9 wchar_t u3 = L'ã©'; // the CJK numeral 9 wchar_t j3 = L'ï¼'; // the full-width digit 9 setlocale(LC_ALL, "en_US.utf8"); puts("In American locale:"); test(a3, u3, j3); setlocale(LC_ALL, "ja_JP.utf8"); puts("\nIn Japanese locale:"); test(a3, u3, j3); }
Possible output:
In American locale: '9' 'ã©' 'ï¼' iswxdigit: 1 0 0 jdigit: 0 0 0 In Japanese locale: '9' 'ã©' 'ï¼' iswxdigit: 1 0 0 jdigit: 0 0 1[edit] References
isxdigit
iswxdigit
\x0
â\x8
\0
â\10
control codes (NUL
, etc.) â 0
0
0
0
0
0
0
0
0
0
0
0
9 \x9
\11
tab (\t
) â 0
0
â 0
â 0
0
0
0
0
0
0
0
0
10â13 \xA
â\xD
\12
â\15
whitespaces (\n
, \v
, \f
, \r
) â 0
0
â 0
0
0
0
0
0
0
0
0
0
14â31 \xE
â\x1F
\16
â\37
control codes â 0
0
0
0
0
0
0
0
0
0
0
0
32 \x20
\40
space 0
â 0
â 0
â 0
0
0
0
0
0
0
0
0
33â47 \x21
â\x2F
\41
â\57
!"#$%&'()*+,-./
0
â 0
0
0
â 0
â 0
0
0
0
0
0
0
48â57 \x30
â\x39
\60
â\71
0123456789
0
â 0
0
0
â 0
0
â 0
0
0
0
â 0
â 0
58â64 \x3A
â\x40
\72
â\100
:;<=>?@
0
â 0
0
0
â 0
â 0
0
0
0
0
0
0
65â70 \x41
â\x46
\101
â\106
ABCDEF
0
â 0
0
0
â 0
0
â 0
â 0
â 0
0
0
â 0
71â90 \x47
â\x5A
\107
â\132
GHIJKLMNOP
QRSTUVWXYZ
0
â 0
0
0
â 0
0
â 0
â 0
â 0
0
0
0
91â96 \x5B
â\x60
\133
â\140
[\]^_`
0
â 0
0
0
â 0
â 0
0
0
0
0
0
0
97â102 \x61
â\x66
\141
â\146
abcdef
0
â 0
0
0
â 0
0
â 0
â 0
0
â 0
0
â 0
103â122 \x67
â\x7A
\147
â\172
ghijklmnop
qrstuvwxyz
0
â 0
0
0
â 0
0
â 0
â 0
0
â 0
0
0
123â126 \x7B
â\x7E
\173
â\176
{|}~
0
â 0
0
0
â 0
â 0
0
0
0
0
0
0
127 \x7F
\177
backspace character (DEL
) â 0
0
0
0
0
0
0
0
0
0
0
0
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4