summaryrefslogtreecommitdiff
path: root/src/ctype/isdigit.c
blob: 7a19fe1941872bec65b53cd0aab0be42ce813336 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <ctype.h>
#include "limits.h"
#include "nonstd/assert.h"

/** test whether a character is a digit **/
int isdigit(int c)
{
	ASSERT_REPRESENTABLE(c, 0, UCHAR_MAX, unsigned char, EOF);
	/*
	RETURN(NONZERO, ARGUMENT(c) is a digit);
	RETURN(0, ARGUMENT(c) is not a digit);
	*/

	return isxdigit(c) && !isalpha(c);
}

/***
tests whether ARGUMENT(c) is a character in the class CHARACTER_CLASS(digit)
in the current locale.
***/

/*
LC_CTYPE
C_LOCALE(`THIS() is true for characters CHAR(0), CHAR(1), CHAR(2), CHAR(3), CHAR(4), CHAR(5), CHAR(6), CHAR(7), CHAR(8), and CHAR(9)')
STDC(1)
*/