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>
π COPYRIGHT π
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
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms