DIGITTOINT(3) Library Functions Manual DIGITTOINT(3)

digittoint, digittoint_lconvert a numeric character to its integer value

Standard C Library (libc, -lc)

#include <ctype.h>

int
digittoint(int c);

#include <xlocale.h>
#include <ctype.h>

int
digittoint_l(int c, locale_t loc);

The () function converts a numeric character to its corresponding integer value. The character can be any decimal digit or hexadecimal digit. With hexadecimal characters, the case of the values does not matter.

While the () function uses the current locale, the () function may be passed a locale directly. See xlocale(3) for more information.

The digittoint() function always returns an integer from the range of 0 to 15. If the given character was not a digit as defined by isxdigit(3), the function will return 0.

ctype(3), isdigit(3), isxdigit(3), xlocale(3)

April 6, 2001 macOS 15.2