int iswdigit( wint_t ch );
Checks if the given wide character corresponds (if narrowed) to one of the ten decimal digit characters 0123456789.
If the value of ch is neither representable as a wchar_t nor equal to the value of the macro WEOF, the behavior is undefined.
[edit] Parameters [edit] Return valueNon-zero value if the wide character is a numeric character, zero otherwise.
[edit] Notesstd::iswdigit
and std::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 <clocale> #include <cwctype> #include <iostream> void test(wchar_t a3, wchar_t u3, wchar_t j3) { std::wcout << std::boolalpha << "\t '" << a3 << "' '" << u3 << "' '" << j3 << "'\n" << "iswdigit: " << (bool)std::iswdigit(a3) << " " << (bool)std::iswdigit(u3) << " " << (bool)std::iswdigit(j3) << '\n' << "jdigit: " << (bool)std::iswctype(a3, std::wctype("jdigit")) << ' ' << (bool)std::iswctype(u3, std::wctype("jdigit")) << ' ' << (bool)std::iswctype(j3, std::wctype("jdigit")) << '\n'; } int main() { wchar_t a3 = L'3'; // the ASCII digit 3 wchar_t u3 = L'ä¸'; // the CJK numeral 3 wchar_t j3 = L'ï¼'; // the full-width digit 3 std::setlocale(LC_ALL, "en_US.utf8"); std::wcout << "In American locale:\n"; test(a3, u3, j3); std::wcout << "\nIn Japanese locale:\n"; std::setlocale(LC_ALL, "ja_JP.utf8"); test(a3, u3, j3); }
Possible output:
In American locale: '3' 'ä¸' 'ï¼' iswdigit: true false false jdigit: false false false In Japanese locale: '3' 'ä¸' 'ï¼' iswdigit: true false false jdigit: false false true[edit] See also ASCII values characters
isdigit
iswdigit
\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
\172
â\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