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 the locale argument to wcscasecmp_l() or wcsncasecmp_l() is the special locale object LC_GLOBAL_LOCALE or 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>


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