wcsspn(3)

✨ wcsspn(3) ✨

okay bestie, gather round, because today we're talking about wcsspn from the Library Functions Manual β€” she lives in the Standard C library (libc, link with -lc) and she is so much chiller than her name makes her look πŸ’–


πŸŽ€ NAME πŸŽ€

wcsspn β€” get the length of a prefix wide-character substring. that's it. that's the job. very demure, very mindful πŸ’…


πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) 🫢


🌸 SYNOPSIS 🌸

#include <wchar.h>

size_t wcsspn(const wchar_t *wcs, const wchar_t *accept);

πŸ’– DESCRIPTION πŸ’–

okay so. wcsspn() is literally the wide-character version of strspn(3) ✨ β€” like, same energy, but for wide chars.

Here's the vibe: it goes through wcs from the very start and asks "how far can I walk while every single character I step on is on the guest list?" The guest list is accept. The second it hits a wide character that is not listed in accept, it stops and tells you how many steps it took. πŸšΆβ™€οΈ

So basically it determines the length of the longest initial segment of wcs that's made up entirely of wide characters listed in accept. In other words: it searches for the first occurrence, inside the wide-character string wcs, of a wide character that is not contained in the wide-character string accept. no cap πŸ”₯


πŸ¦‹ RETURN VALUE πŸ¦‹

wcsspn() returns the number of wide characters in that longest initial segment of wcs which consists entirely of wide characters listed in accept. πŸ’―

Or, said the other way (same tea, different mug): it returns the position of the first occurrence in the wide-character string wcs of a wide character that is not contained in the wide-character string accept β€” or, if there is no such character at all, it returns wcslen(wcs). 🌈


πŸ‘‘ ATTRIBUTES πŸ‘‘

for the explanation of the terms used in this section, go check out attributes(7) bestie 🫢

  • Interface: wcsspn()
    • Attribute: Thread safety
    • Value: MT-Safe ✨

πŸ’œ STANDARDS πŸ’œ

  • C11
  • POSIX.1-2008

🌟 HISTORY 🌟

  • POSIX.1-2001
  • C99

πŸ” SEE ALSO πŸ”


aaand that's the whole page, bestie πŸ’– that was Linux man-pages 6.20, dated 2026-02-08 β€” and yes, the page is literally called wcsspn(3), the way that it ate and left no crumbs πŸ‘‘βœ¨πŸ’…

πŸ“¦ where this page comes from
  • 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 6.20
  • πŸ“œ the page's license: GPL-2.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms