C Standard Libraries C++

iswalpha()

Declaration

int iswalpha(wint_t wChar);

Description

This function returns a nonzero integer value if the passed in value is an alphabetic character in the unicode table. Otherwise it returns zero. The argument is considered alphabetic if either of the functions iswupper() and iswlower() returns a nonzero value and none of the functions iswcntrl() iswdigit(), iswpunct(), or iswpunct() returns a nonzero value.

Example

#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)iswalpha(iIndex);
        // Add an endline every 16 characters
        if ((iIndex) % 16 == 15) {
            cout << endl;
        }
    }
    return 0;
}

Output

iswalpha() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.