__wcsicmp() — Compare Wide Character Strings without Case Sensitivity
Format
#include <wchar.h>
int __wcsicmp(const wchar_t *string1, const wchar_t *string2);
Language Level
Extension
Threadsafe
Yes
Locale Sensitive
The behavior of this function might be affected by the LC_CTYPE category of the current locale if LOCALETYPE(*LOCALE) is specified on the compilation command. The behavior of this function might also be affected by the LC_UNI_CTYPE category of the current locale if LOCALETYPE(*LOCALEUCS2) or LOCALETYPE(*LOCALEUTF) is specified on the compilation command. This function is not available when LOCALETYPE(*CLD) is specified on the compilation command. For more information, see Understanding CCSIDs and Locales.
Wide Character Function
See Wide Characters for more information.
Description
The __wcsicmp()
function
compares string1 and string2 without sensitivity to
case. All alphabetic wide characters in string1 and string2 are
converted to lowercase before comparison. The function operates on
null terminated wide character strings. The string arguments to the
function are expected to contain a wchar_t null character (L'\0')
marking
the end of the string.
Return Value
The__wcsicmp()
function
returns a value indicating the relationship between the two strings
as follows:
Value | Meaning |
---|---|
Less than 0 | string1 less than string2 |
0 | string1 equivalent to string2 |
Greater than 0 | string1 greater than string2 |
Example
__wcsicmp()
to
compare two wide character strings. #include <stdio.h>
#include <wchar.h>
int main(void)
{
wchar_t *str1 = L"STRING";
wchar_t *str2 = L"string";
int result;
result = __wcsicmp(str1, str2);
if (result == 0)
printf("Strings compared equal.\n");
else if (result < 0)
printf("\"%ls\" is less than \"%ls\".\n", str1, str2);
else
printf("\"%ls\" is greater than \"%ls\".\n", str1, str2);
return 0;
}
/******** The output should be similar to: ***************
Strings compared equal.
***********************************/
Related Information
- strcmp() — Compare Strings
- strncmp() — Compare Strings
- wcscat() — Concatenate Wide-Character Strings
- wcschr() — Search for Wide Character
- wcscspn() — Find Offset of First Wide-Character Match
- wcslen() — Calculate Length of Wide-Character String
- wcsncmp() — Compare Wide-Character Strings
- __wcsnicmp() — Compare Wide Character Strings without Case Sensitivity
- <wchar.h>