digittoint_l(3)

digittoint_l3

Convert a numeric character to its integer value

Part of digittoint(3).

Usage

#include <ctype.h>

int

digittoint(int c);

int

digittoint_l(int c, locale_t loc);

Library

Standard C Library (libc, -lc)

Overview

The digittoint() and digittoint_l() functions convert 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.

The digittoint_l() function takes an explicit locale argument, whereas the digittoint() function use the current global or per-thread locale.

Return values

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

Releases

13 releases since FreeBSD 13.2-RELEASE; the text changed 2 times.

  1. 13.2
  2. 13.3–14.5
  3. 15.0–16.0

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.