STRCSPN(3P)

✨ STRCSPN(3P) ✨

okay so this is the POSIX Programmer's Manual page for strcspn, and we are gonna get you fluent in it, bestie πŸ’–


🌸 PROLOG 🌸

This manual page is part of the POSIX Programmer's Manual. Heads up though β€” the Linux implementation of this interface may differ, so if you're on Linux go consult the corresponding Linux manual page for the details of Linux behavior. Also possible: the interface may just not be implemented on Linux at all. Vibe check your platform first, fr fr.


πŸŽ€ NAME πŸŽ€

strcspn β€” get the length of a complementary substring


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <string.h>

size_t strcspn(const char *s1, const char *s2);

πŸ’… DESCRIPTION πŸ’…

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, no beef, it's not on purpose. This volume of POSIX.1‐2017 defers to the ISO C standard, periodt.

Okay so the actual tea β˜• β€” the strcspn() function shall compute the length (in bytes) of the maximum initial segment of the string pointed to by s1 which consists entirely of bytes not from the string pointed to by s2.

Think of it like this: s1 is your main character string πŸ‘‘, and s2 is the ick list. strcspn() walks from the very start of s1 and counts bytes while they are not on the ick list. The second it hits a byte that IS in s2, it stops counting and hands you the count. That count is in bytes, not vibes. πŸ’€


⭐ RETURN VALUE ⭐

The strcspn() function shall return the length of the computed segment of the string pointed to by s1. And here's the thing β€” no return value is reserved to indicate an error. Like, there's no special "oops" number. It just returns the length. That's the whole personality. 🫢


πŸ’œ ERRORS πŸ’œ

No errors are defined. Not one. It's giving flawless. ✨

The following sections are informative.


πŸ“ EXAMPLES πŸ“

None. (Literally none, bestie. The page said so. 😭)


🌈 APPLICATION USAGE 🌈

None. (Again! Nothing here! We love a low-effort section. πŸ™ˆ)


🧚 RATIONALE 🧚

None. (Nothing! The rationale is a mystery even to me. πŸ”₯)


πŸŽ€ FUTURE DIRECTIONS πŸŽ€

None. (The future is unwritten. Or, y'know, unspecified. πŸ’–)


πŸ‘‘ SEE ALSO πŸ‘‘

  • strspn()

The Base Definitions volume of POSIX.1‐2017, <string.h>


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, bestie!! 🫢 this one came to you from IEEE/The Open Group, 2017, filed under STRCSPN(3P) πŸ’…βœ¨ go count some bytes, you absolute icon πŸŽ€

πŸ“¦ where this page comes from