RAD Studio
ContentsIndex
PreviousUpNext
isdigit, iswdigit, _ismbcdigit

Header File 

ctype.h, mbstring.h 

Category 

Classification Routines 

Prototype 

int isdigit(int c); 

int iswdigit(wint_t c); 

int _ismbcdigit(unsigned int c); 

Description 

Tests for decimal-digit character. 

isdigit is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is a digit (0 to 9). 

You can make this macro available as a function by undefining (#undef) it. 

Return Value 

isdigit returns nonzero if c is a digit. 

_ismbcdigit returns true if and only if the argument c is a single-byte representation of an ASCII digit. 

Example  

#include <stdio.h>
#include <ctype.h>
int main(void)
{
  char c = 'C';
  if (isdigit(c))
    printf("%c is a digit\n",c);
  else 
    printf("%c is not a digit\n",c);
  return 0;
}

Portability

 
POSIX 
Win32 
ANSI C 
ANSI C++ 
isdigit 
_ismbcdigit 
 
 
 
iswdigit 
 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!