int iswctype(wint_t wChar, wctype_t qCategory);
The type category can be generated by the function wctype(), so that the following function calls are equivalent:
iswalnum(wChar) = iswctype(wChar, wctype("alnum"))
iswalpha(wChar) = iswctype(wChar, wctype("alpha"))
iswcntrl(wChar) = iswctype(wChar, wctype("cntrl"))
iswdigit(wChar) = iswctype(wChar, wctype("digit"))
iswgraph(wChar) = iswctype(wChar, wctype("graph"))
iswlower(wChar) = iswctype(wChar, wctype("lower"))
iswprint(wChar) = iswctype(wChar, wctype("print"))
iswpunct(wChar) = iswctype(wChar, wctype("punct"))
iswspace(wChar) = iswctype(wChar, wctype("space"))
iswupper(wChar) = iswctype(wChar, wctype("upper"))
iswxdigit(wChar) = iswctype(wChar, wctype("xdigit"))
#include <iostream>
#include <cwctype>
int main() {
using namespace std;
// Output the column headings
cout << " ";
for (int iIndex = 0; iIndex < 16; ++iIndex) {
if (iIndex < 10) {
cout << " ";
}
cout << " " << iIndex;
}
cout << endl << endl;
for (int iIndex = 0; iIndex < 352; ++iIndex) {
// Output the row heading every 16 places
if ((iIndex) % 16 == 0) {
if (iIndex < 10) {
cout << " ";
} else if (iIndex < 100) {
cout << " ";
}
cout << iIndex << " ";
}
cout << " " << (bool)iswctype(iIndex, wctype("alnum"));
// Add an endline every 16 characters
if ((iIndex) % 16 == 15) {
cout << endl;
}
}
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.