WCSCASECMP(3P)
π WCSCASECMP(3P) β the POSIX Programmer's Manual, bestie edition π
okay so real quick: this page lives in the POSIX Programmer's Manual, and we're talking about wcscasecmp and its lil squad. wide characters, case-insensitive comparison, all the drama. let's get into it π
β¨ PROLOG β¨
okay so heads up before we even start: this manual page is part of the POSIX Programmer's Manual.
the Linux implementation of this interface may differ (so like, pls consult the corresponding Linux manual page for the tea on Linux behavior), or honestly the interface may just... not be implemented on Linux at all. π
πΈ NAME πΈ
wcscasecmp, wcscasecmp_l, wcsncasecmp, wcsncasecmp_l β case-insensitive wide-character string comparison
like. that's the whole vibe. comparing wide strings but we're β¨ ignoring case β¨
π¦ SYNOPSIS π¦
#include <wchar.h>
int wcscasecmp(const wchar_t *ws1, const wchar_t *ws2);
int wcscasecmp_l(const wchar_t *ws1, const wchar_t *ws2,
locale_t locale);
int wcsncasecmp(const wchar_t *ws1, const wchar_t *ws2, size_t n);
int wcsncasecmp_l(const wchar_t *ws1, const wchar_t *ws2,
size_t n, locale_t locale);
π DESCRIPTION π
okay so here's the whole thing, no cap.
wcscasecmp() and wcsncasecmp() are the wide-character equivalent of the strcasecmp() and strncasecmp() functions, respectively. so if you know those two, you already know the family energy. π«Ά
wcscasecmp() and wcscasecmp_l() shall compare, while ignoring differences in case, the wide-character string pointed to by ws1 to the wide-character string pointed to by ws2. just straight up comparing the two, but case is not the moment. π
wcsncasecmp() and wcsncasecmp_l() shall compare, while ignoring differences in case, not more than n wide-characters from the wide-character string pointed to by ws1 to the wide-character string pointed to by ws2. so it's the same idea but with a limit, bestie. β¨
wcscasecmp() and wcsncasecmp() use the current locale to determine the case of the wide characters.
wcscasecmp_l() and wcsncasecmp_l() use the locale represented by locale to determine the case of the wide characters. (the _l suffix really said "i brought my own locale" π)
when the LC_CTYPE category of the locale being used is from the POSIX locale, these functions shall behave as if the wide-character strings had been converted to lowercase and then a comparison of wide-character codes performed. otherwise, the results are unspecified. so like. unspecified. not "wrong", just... undefined vibes. π
the information for wcscasecmp_l() and wcsncasecmp_l() about the case of the characters comes from the locale represented by locale.
okay bestie this is the important scary part: the behavior is undefined if thelocaleargument towcscasecmp_l()orwcsncasecmp_l()is the special locale objectLC_GLOBAL_LOCALEor is not a valid locale object handle. undefined behavior is not a vibe. do not do it. π
π RETURN VALUE π
upon completion, wcscasecmp() and wcscasecmp_l() shall return an integer greater than, equal to, or less than 0 if the wide-character string pointed to by ws1 is, ignoring case, greater than, equal to, or less than the wide-character string pointed to by ws2, respectively. classic three-way result, she ate. π
upon completion, wcsncasecmp() and wcsncasecmp_l() shall return an integer greater than, equal to, or less than 0 if the possibly null wide-character terminated string pointed to by ws1 is, ignoring case, greater than, equal to, or less than the possibly null wide-character terminated string pointed to by ws2, respectively. yes the "possibly null wide-character terminated" part matters, i said what i said. β¨
no return values are reserved to indicate an error. so like, if you see a weird number, that's not an error code, that's just the comparison result. π
π ERRORS π
no errors are defined. iconic behavior honestly, nothing to report.
the following sections are informative:
π§ EXAMPLES π§
none. π (yeah. no examples. we move.)
πΈ APPLICATION USAGE πΈ
none.
β¨ RATIONALE β¨
none.
π¦ FUTURE DIRECTIONS π¦
none.
π₯ SEE ALSO π₯
strcasecmp()wcscmp()wcsncmp()
the Base Definitions volume of POSIX.1β2017, <wchar.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. (so like, the original is the one holding the gavel, periodt. π)
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 lil cutie came to you courtesy of IEEE/The Open Group, 2017 β yeah, 2017, she's been slaying in the archives this whole time. mwah πβ¨
π¦ 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