wcsstr(3)
π wcsstr(3) β the wide-char girlies' substring finder π
okay so bestie, welcome to the wcsstr(3) page from the Library Functions Manual β yes it lives in section 3, we love a library-call moment. pull up a chair, grab a boba, and let's find some substrings β¨
πΈ NAME πΈ
wcsstr β locate a substring in a wide-character string
π LIBRARY π
Standard C library (libc, -lc)
β¨ SYNOPSIS β¨
#include <wchar.h>
wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle);
π§ DESCRIPTION π§
so wcsstr() is literally the wide-character version of strstr(3), no cap. it's giving same energy, wider chars π
what it does: it searches for the first occurrence of the wide-character string needle β and bestie, note that the terminating null wide character (L'\0') of needle is not included in the search β as a substring inside the wide-character string haystack. iconic behaviour honestly π«Ά
think of it like: haystack is the group chat, needle is the message you're scrolling for, and wcsstr() is you, finding it. main character energy π₯
π RETURN VALUE π
wcsstr() hands you back a pointer to the first occurrence of needle inside haystack. slay.
but if needle doesn't occur as a substring in haystack at all? it returns NULL. π (sad, but predictable, we respect it.)
β special case alert β bestie listen up: ifneedleis the empty wide-character string, the return value is alwayshaystackitself. yes, always. that's the rule. periodt.
π ATTRIBUTES π
for the full explanation of what these terms even mean, go peek at attributes(7). here's the vibe check for this one:
- Interface:
wcsstr() - Attribute: Thread safety
- Value:
MT-Safe
(translation: it's thread-safe, she's stable, she's trustworthy π¦)
π STANDARDS π
C11, POSIX.1-2008. certified, official, on the syllabus π
π°οΈ HISTORY π°οΈ
POSIX.1-2001, C99. she's been around, she's got lore π
π SEE ALSO π
and that's the whole page, bestie β go forth and find your substrings π
Linux man-pages 6.20 Β· last touched 2026-02-08 Β· mwah, ily, bye ππ§β¨
π¦ 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