digittoint(3)

digittoint3

Convert a numeric character to its integer value

Usage

#include <ctype.h>

int

digittoint(int c);

#include <xlocale.h>

#include <ctype.h>

int

digittoint_l(int c, locale_t loc);

Library

Standard C Library (libc, -lc)

Overview

The digittoint() 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 digittoint() function uses the current locale, the digittoint_l() function may be passed a locale directly. See xlocale(3) for more information.

Return values

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.

Releases

145 releases since Mac OS X 10.3; the text changed 3 times.

  1. 10.3–10.3.9
  2. 10.4–10.4.11
  3. 10.5–10.6.8
  4. 10.7–26.5

From Libc 1752.120.2 in macOS 26.5. Parsed by carta from the page's mdoc source.