ISDIGIT(3P)

πŸ’– ISDIGIT(3P) β€” the POSIX Programmer's Manual era πŸ’–

okay bestie, sit down, hydrate, because we're about to talk about checking whether a character is a digit and honestly? it's giving foundational. this one lives in the POSIX Programmer's Manual (that's the 3P vibe, iykyk).

✨ PROLOG ✨

real talk before anything else: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ β€” so if you're on Linux, go consult the corresponding Linux manual page for details on Linux behavior β€” or, plot twist, the interface may not even be implemented on Linux at all. πŸ™ˆ


πŸŽ€ NAME πŸŽ€

isdigit, isdigit_l β€” test for a decimal digit

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <ctype.h>

int isdigit(int c);
int isdigit_l(int c, locale_t locale);

πŸ’… DESCRIPTION πŸ’…

okay so, for isdigit() specifically: the functionality described on this reference page is aligned with the ISO C standard. any conflict between the requirements described here and the ISO C standard is unintentional β€” no drama intended, fr. this volume of POSIX.1‐2017 defers to the ISO C standard.

the isdigit() and isdigit_l() functions shall test whether c is a character of class digit in the current locale, or in the locale represented by locale, respectively. (see the Base Definitions volume of POSIX.1‐2017, Chapter 7, Locale β€” that's where the locale lore lives πŸ“–).

the c argument is an int, the value of which the application shall ensure is a character representable as an unsigned char or equal to the value of the macro EOF.

bestie, listen: if the argument has any other value, the behavior is undefined. not "a little weird", not "probably fine" β€” undefined. we don't do that here. 🚫

and more warnings, because of course:

the behavior is undefined if the locale argument to isdigit_l() is the special locale object LC_GLOBAL_LOCALE, or is not a valid locale object handle. πŸ’€

🌟 RETURN VALUE 🌟

the isdigit() and isdigit_l() functions shall return non-zero if c is a decimal digit; otherwise, they shall return 0. simple. iconic. no notes.

🌈 ERRORS 🌈

no errors are defined. (slay, honestly.)

the following sections are informative. ✨

πŸ“ EXAMPLES πŸ“

none. that's it. that's the section. 🫢

πŸ‘‘ APPLICATION USAGE πŸ‘‘

to ensure applications portability β€” especially across natural languages, which is a whole mood β€” only these functions and the functions in the reference pages listed in the SEE ALSO section should be used for character classification. don't get cute with it. πŸ’–

🧚 RATIONALE 🧚

none.

⭐ FUTURE DIRECTIONS ⭐

none.

πŸ’œ SEE ALSO πŸ’œ

  • isalnum()
  • isalpha()
  • isblank()
  • iscntrl()
  • isgraph()
  • islower()
  • isprint()
  • ispunct()
  • isspace()
  • isupper()
  • isxdigit()

also, from the Base Definitions volume of POSIX.1‐2017: Chapter 7, Locale, plus <ctype.h> and <locale.h>. the holy trinity of "yes, this is where the locale stuff is defined." πŸ“š

portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.

in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


okay that's the whole page bestie, and yes, it was written by IEEE/The Open Group, dated 2017, under the title ISDIGIT(3P) β€” periodt. go classify some characters responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from