C Programming/C Reference/wctype.h/iswdigit

From Wikibooks, open books for an open world
Jump to: navigation, search

iswdigit is a function in included in the C Standard Library header wctype.h. It checks if a wide character is a decimal digit in the current locale (always includes '0' to '9'). The iswdigit function is a wide charactered version of isdigit function.

Syntax[edit]

int iswdigit(wint_t wc);

Return value[edit]

The iswdigit function return non zero value if its argument is a digit between 0 to 9. In other cases, a zero value because of it's independent working.

Example[edit]

#include <stdio.h>
#include <wctype.h>
 
int main(void) {
    for (unsigned i = 0; i < 0xff; i++) {
        printf("%x, %s\n", i, iswdigit(i) ? "digit" : "not a digit");
    }
    return 0;
}

References[edit]