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: if needle is the empty wide-character string, the return value is always haystack itself. 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