WCSCASECMP(3C) Standard C Library Functions WCSCASECMP(3C)
wcscasecmp, wcscasecmp_l, wcsncasecmp, wcsncasecmp_l - case-insensitive
wide-character string comparison
#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 loc);
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 loc);
These functions perform case-insensitive comparison of wide-character
strings ws1 and ws2. Pairs of wide-characters from each of ws1 and ws2
are compared consecutively, ignoring differences in case (if the
"POSIX" locale upper case characters are treated as lower case). If
the two values are different, the comparison stops and either a
negative value is returned if the character from ws1 is less than that
from ws2, or a positive is returned if the character from ws1 is
greater than that from ws2. The comparison also stops if both
characters are null wide-characters, or, in the case of wcsncasecmp()
and wcsncasecmp_l(), after n comparisons have been made without finding
a difference. In either of these two cases, 0 is returned.
The wcscasecmp() and wcsncasecmp() functions use the LC_CTYPE category
of the current locale to determine case. The wcscasecmp_l() and
wcsncasecmp_l() functions use the LC_CTYPE category of the locale
pointed to by loc to determine case.
Passing LC_GLOBAL_LOCALE for loc results in undefined behavior.
The wcscasecmp(), wcsncasecmp(), wcscasecmp_l(), and wcsncasecmp_l()
functions are the wide-character equivalents of the strcasecmp(),
strncasecmp(), strcasecmp_l(), and strncasecmp_l() functions,
respectively.
These functions return a negative value if, ignoring case, ws1 is less
than ws1, or a positive value if ws1 is greater than ws2, or 0 if the
both ws1 and ws2 are the same.
None.
Standard.
MT-LEVEL
MT-Safe.
newlocale(3C), setlocale(3C), strcasecmp(3C), strcasecmp_l(3C),
strncasecmp(3C), strncasecmp_l(3C), uselocale(3C), wchar.h(3HEAD),
locale(7), standards(7)
The wcscasecmp(), wcsncasecmp(), wcscasecmp_l(), and wcsncasecmp_l()
functions were introduced in IEEE Std 1003.1-2008 ("POSIX.1").
illumos February 17, 2023 illumos
NAME
wcscasecmp, wcscasecmp_l, wcsncasecmp, wcsncasecmp_l - case-insensitive
wide-character string comparison
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 loc);
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 loc);
DESCRIPTION
These functions perform case-insensitive comparison of wide-character
strings ws1 and ws2. Pairs of wide-characters from each of ws1 and ws2
are compared consecutively, ignoring differences in case (if the
"POSIX" locale upper case characters are treated as lower case). If
the two values are different, the comparison stops and either a
negative value is returned if the character from ws1 is less than that
from ws2, or a positive is returned if the character from ws1 is
greater than that from ws2. The comparison also stops if both
characters are null wide-characters, or, in the case of wcsncasecmp()
and wcsncasecmp_l(), after n comparisons have been made without finding
a difference. In either of these two cases, 0 is returned.
The wcscasecmp() and wcsncasecmp() functions use the LC_CTYPE category
of the current locale to determine case. The wcscasecmp_l() and
wcsncasecmp_l() functions use the LC_CTYPE category of the locale
pointed to by loc to determine case.
Passing LC_GLOBAL_LOCALE for loc results in undefined behavior.
The wcscasecmp(), wcsncasecmp(), wcscasecmp_l(), and wcsncasecmp_l()
functions are the wide-character equivalents of the strcasecmp(),
strncasecmp(), strcasecmp_l(), and strncasecmp_l() functions,
respectively.
RETURN VALUES
These functions return a negative value if, ignoring case, ws1 is less
than ws1, or a positive value if ws1 is greater than ws2, or 0 if the
both ws1 and ws2 are the same.
ERRORS
None.
INTERFACE STABILITY
Standard.
MT-LEVEL
MT-Safe.
SEE ALSO
newlocale(3C), setlocale(3C), strcasecmp(3C), strcasecmp_l(3C),
strncasecmp(3C), strncasecmp_l(3C), uselocale(3C), wchar.h(3HEAD),
locale(7), standards(7)
STANDARDS
The wcscasecmp(), wcsncasecmp(), wcscasecmp_l(), and wcsncasecmp_l()
functions were introduced in IEEE Std 1003.1-2008 ("POSIX.1").
illumos February 17, 2023 illumos