wcscasecmp(3)

πŸ’– wcscasecmp(3) β€” the wide-char girlies who don't care about case πŸ’–

okay bestie, sit down, hydrate, because we're talking about wcscasecmp and wcsncasecmp β€” two absolute icons from the Library Functions Manual of the wcscasecmp(3) page. they compare two wide-character strings and just. don't. care. about case. lowercase, uppercase, whatever, they're not judging πŸ’…


✨ NAME ✨

wcscasecmp, wcsncasecmp β€” compare two wide-character strings, ignoring case

like, fr fr, that's the whole vibe. two wide strings walk in, case gets ignored, somebody's declared greater. iconic behavior.


πŸŽ€ LIBRARY πŸŽ€

Standard C library (libc, -lc)

so you gotta link the -lc bestie, that's where the magic lives 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <wchar.h>

int wcscasecmp(const wchar_t *s1, const wchar_t *s2);
int wcsncasecmp(const wchar_t s1[], const wchar_t s2[], size_t n);

πŸ’œ Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

wcscasecmp(), wcsncasecmp():

  • Since glibc 2.10:
    • _POSIX_C_SOURCE >= 200809L
  • Before glibc 2.10:
    • _GNU_SOURCE

so depending on how ancient your glibc is, you either flex _POSIX_C_SOURCE >= 200809L or you go full old-school and define _GNU_SOURCE. glow-up requirements, basically ✨


🌈 DESCRIPTION 🌈

so wcscasecmp() is literally the wide-character equivalent of the strcasecmp(3) function. she takes the wide-character string pointed to by s1 and the wide-character string pointed to by s2 and compares them, ignoring case differences β€” shoutout to towupper(3) and towlower(3) for handling that part, they're the ones doing the case-flipping behind the scenes 🫢

and wcsncasecmp()? she's the same energy, the wide-character equivalent of strncasecmp(3), except she compares no more than n wide characters of s1 and s2. boundaries, bestie. she has them. n is the limit and she respects it πŸ’…


πŸ‘‘ RETURN VALUE πŸ‘‘

wcscasecmp() and wcsncasecmp() hand you back an integer that is:

  • less than zero β†’ s1 is, after ignoring case, found to be less than s2
  • equal to zero β†’ s1 matches s2
  • greater than zero β†’ s1 is, after ignoring case, found to be greater than s2

that's it. that's the whole report card. no cap πŸ“


πŸ”₯ ATTRIBUTES πŸ”₯

for the full explanation of what these terms even mean, go peek at attributes(7) β€” she explains everything, she's the source.

  • wcscasecmp(), wcsncasecmp() β€” Thread safety: MT-Safe locale

so yes, thread-safe, but she's locale-dependent about it β€” MT-Safe locale is the exact vibe, don't forget the locale part 😭


⭐ STANDARDS ⭐

POSIX.1-2008.

certified, standardized, official. she said "I'm in the spec" and she was right πŸ’–


🧚 HISTORY 🧚

glibc 2.1.

she's been here since glibc 2.1, an elder stateswoman of wide-char case-insensitive comparison, and she's still serving 🌸


πŸ“ NOTES πŸ“

the behavior of wcscasecmp() depends on the LC_CTYPE category of the current locale.

⚠️ bestie this matters β€” swap your locale, swap her whole attitude. LC_CTYPE is running the show here, so set it with intention, mwah πŸ’‹

🌟 SEE ALSO 🌟

go read those too, they're her cousins and they also ate ✨


okay that's the whole page, you're officially educated πŸ’… and one last thing β€” this lil masterpiece lives in Linux man-pages 6.20, dated 2026-02-08, page wcscasecmp(3). so when you cite her, cite her correctly bestie πŸŽ€ bye, ily, go compare some wide strings βœ¨πŸ¦‹πŸ’–

πŸ“¦ 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