ISDIGIT(3POSIX)

πŸ’– ISDIGIT(3POSIX) πŸ’–

okay bestie, welcome to the POSIX Programmer's Manual ✨ (yes that's the manual this page lives in, we're fancy now)


🌸 PROLOG 🌸

Real talk first, no cap: 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 check the corresponding Linux manual page for the actual tea β˜•. Or, plot twist, the interface might 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 πŸ¦‹

So for isdigit(): the functionality described on this reference page is aligned with the ISO C standard. If there's any conflict between the requirements described here and the ISO C standard, that conflict is unintentional β€” like, nobody meant that. This volume of POSIX.1‐2017 defers to the ISO C standard, periodt.

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. (Want the lore? See the Base Definitions volume of POSIX.1‐2017, Chapter 7, Locale. iykyk πŸ“–)

The c argument is an int, and the value of it β€” the application shall ensure it's a character representable as an unsigned char, or equal to the value of the macro EOF. Any other value? Behavior is undefined. πŸ’€ Not "undefined-ish", not "kinda weird", undefined. Don't do it.

Also undefined behavior: if the locale argument to isdigit_l() is the special locale object LC_GLOBAL_LOCALE, or if it's not a valid locale object handle. That's a hard no, bestie. 🚫

πŸ”₯ RETURN VALUE πŸ”₯

isdigit() and isdigit_l() shall return non-zero if c is a decimal digit. Otherwise? They shall return 0. Simple as. ✨


πŸ‘‘ ERRORS πŸ‘‘

No errors are defined. None. Zero. Nothing to see here, it's giving flawless. πŸ’…

The following sections are informative. (translation: the vibes-only sections, no requirements in here 🫢)


🌈 EXAMPLES 🌈

None. 😭


πŸ“ APPLICATION USAGE πŸ“

To ensure applications portability β€” especially across natural languages, which is a whole thing β€” only these functions and the functions in the reference pages listed in the SEE ALSO section should be used for character classification. Don't freestyle with random other stuff, bestie. Stay in the list. ⭐


🧚 RATIONALE 🧚

None.


πŸ’œ FUTURE DIRECTIONS πŸ’œ

None.


🌸 SEE ALSO 🌸

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

Also:

  • The Base Definitions volume of POSIX.1‐2017, Chapter 7, Locale
  • <ctype.h>
  • <locale.h>

okay legal bestie moment, gotta be precise here:

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 .


and that's the whole page, babe πŸ’… this one's from IEEE/The Open Group, 2017 β€” mwah, see u in the next manpage, ISDIGIT(3POSIX) out πŸŽ€βœ¨