isnumber(3)

isnumber3

Decimal-digit character test

Part of isdigit(3).

Usage

#include <ctype.h>

int

isdigit(int c);

int

isnumber(int c);

int

isdigit_l(int c, locale_t loc);

int

isnumber_l(int c, locale_t loc);

Library

Standard C Library (libc, -lc)

Overview

The isdigit() and isdigit_l() functions test for a decimal digit character. Regardless of locale, this includes the following characters only:

``0''``1''``2''``3''``4''
``5''``6''``7''``8''``9''

The isnumber() and isnumber_l() functions behave similarly to isdigit() and isdigit_l(), but may recognize additional characters, depending on the current locale setting.

The value of the argument must be representable as an unsigned char or the value of EOF.

The _l-suffixed versions take an explicit locale argument, whereas the non-suffixed versions use the current global or per-thread locale.

Return values

The isdigit(), isdigit_l(), isnumber(), and isnumber_l() functions return zero if the character tests false and return non-zero if the character tests true.

Compatibility

The 4.4BSD extension of accepting arguments outside of the range of the unsigned char type in locales with large character sets is considered obsolete and may not be supported in future releases. The iswdigit() or iswdigit_l() function should be used instead.

Releases

56 releases since FreeBSD 5.0-RELEASE; the text changed 37 times.

  1. 5.0–5.2.1
  2. 5.3–5.5
  3. 6.0–6.2
  4. 6.3
  5. 6.4
  6. 7.0
  7. 7.1
  8. 7.2
  9. 7.3
  10. 7.4
  11. 8.0
  12. 8.1
  13. 8.2
  14. 8.3
  15. 8.4
  16. 9.0
  17. 9.1
  18. 9.2
  19. 9.3
  20. 10.0
  21. 10.1
  22. 10.2
  23. 10.3
  24. 10.4
  25. 11.0
  26. 11.1
  27. 11.2
  28. 11.3
  29. 11.4
  30. 12.0
  31. 12.1
  32. 12.2
  33. 12.3
  34. 12.4
  35. 13.0–13.1
  36. 13.2
  37. 13.3–14.5
  38. 15.0–16.0

Standards

The isdigit() function conforms to ISO/IEC 9899:1990 (“ISO C90”). The isdigit_l() function conforms to IEEE Std 1003.1-2008 (“POSIX.1”).

History

The isnumber() function appeared in 4.4BSD.

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