Locale-Sensitive C/C++ Collation Function
int strcasecmp(const char *s1, const char *s2);
int wcscasecmp(const wchar_t *ws1, const wchar_T *ws2);
Internationalization (I18n) Function Overview
strcasecmp is like strcmp ,
except that differences in case are ignored. How uppercase and lowercase characters are related
is determined by the currently selected locale. In the standard C locale the
characters Ä and ä do not match but in a locale which regards these characters as parts of the alphabet they do match.
wcscasecmp is like wcscmp , except that
differences in case are ignored. How uppercase and lowercase characters are related is determined
by the currently selected locale. In the standard C locale the
characters Ä and ä do not match but in a locale which regards these characters as parts of the alphabet they do match.
I18n Issues
The single-byte version of the function, strcasecmp , should not be used for equality comparison, because it will only work with single-byte characters.
On ANSI UTF-8 platforms, convert the UTF-8 strings to wide character strings and then call wcscasecmp on the wide strings.
In addition, these functions should not be used for character collation, i.e. alphabetization, because outside of the ASCII subset of characters, they will not sort according to the character set sort order rules of a specific locale.
Instead, call one of the collation functions listed below.
Prior to calling wcscasecmp ensure that the current locale is set properly by calling setlocale , as string comparison is dependent on the LC_CTYPE locale category.
Recommended Replacements*
For equality comparisons use
For purposes of character collation, there are multibyte and wide functions for handling international sorting. These functions differ from the traditional strcasecmp in that they use locale-specific sorting rather than collating by a character's encoded value. The value assigned to LC_COLLATE within the machine's environment when the program runs dictates the locale-specific sorting rules drawn from by the collation functions.
For collation use
*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.
Collation Functions
|