function
<cwctype>

iswdigit

int iswdigit (wint_t c);
Check if wide character is decimal digit
Checks whether c is a decimal digit character.

A decimal digit is any of: 0 1 2 3 4 5 6 7 8 9

This function is the wide-character equivalent of isdigit (<cctype>): If c translates with wctob to a character for which isdigit is true, it is always considered a decimal digit character by this function too.

In C++, a locale-specific template version of this function (isdigit) exists in header <locale> for all character types.

Parameters

c
Wide character to be checked, casted to a wint_t, or WEOF.
wint_t is an integral type.

Return Value

A value different from zero (i.e., true) if indeed c is a decimal digit. Zero (i.e., false) otherwise.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* iswdigit example */
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
int main ()
{
  wchar_t str[] = L"1776ad";
  long int year;
  if (iswdigit(str[0]))
  {
    year = wcstol (str,NULL,10);
    wprintf (L"The year that followed %ld was %ld.\n",year,year+1);
  }
  return 0;
}

Output:
The year 1777 followed 1776


See also