Export (0) Print
Expand All
div
eof
Expand Minimize

_strnicoll, _wcsnicoll, _mbsnicoll, _strnicoll_l, _wcsnicoll_l, _mbsnicoll_l 

Compare strings using locale-specific information.


int _strnicoll(
   const char *string1,
   const char *string2,
   size_t count 
);
int _wcsnicoll(
   const wchar_t *string1,
   const wchar_t *string2 ,
   size_t count 
);
int _mbsnicoll(
   const unsigned char *string1,
   const unsigned char *string2,
   size_t count 
);
int _strnicoll_l(
   const char *string1,
   const char *string2,
   size_t count,
   _locale_t locale
);
int _wcsnicoll_l(
   const wchar_t *string1,
   const wchar_t *string2 ,
   size_t count,
   _locale_t locale
);
int _mbsnicoll_l(
   const unsigned char *string1,
   const unsigned char *string2,
   size_t count,
   _locale_t locale
);

Parameters

string1, string2

Null-terminated strings to compare

count

Number of characters to compare

locale

The locale to use.

Each of these functions returns a value indicating the relationship of the substrings of string1 and string2, as follows.

Return value Relationship of string1 to string2

< 0

string1 less than string2

0

string1 identical to string2

> 0

string1 greater than string2

Each of these functions returns _NLSCMPERROR. To use _NLSCMPERROR, include either STRING.H or MBSTRING.H. _wcsnicoll can fail if either string1 or string2 contains wide-character codes outside the domain of the collating sequence. When an error occurs, _wcsnicoll may set errno to EINVAL. To check for an error on a call to _wcsnicoll, set errno to 0 and then check errno after calling _wcsnicoll.

Each of these functions performs a case-insensitive comparison of the first count characters in string1 and string2 according to the code page. These functions should be used only when there is a difference between the character set order and the lexicographic character order in the code page and this difference is of interest for the string comparison. The versions of these functions without the _l suffix use the current locale and code page. The versions with the _l suffix are identical except that they use the locale passed in instead.

All of these functions validate their parameters. If either string1 or string2 is a null pointer, or if count is greater than INT_MAX, the invalid parameter handler is invoked, as described in Parameter Validation . If execution is allowed to continue, these functions return _NLSCMPERROR and set errno to EINVAL.

Generic-Text Routine Mappings
TCHAR.H routine _UNICODE & _MBCS not defined _MBCS defined _UNICODE defined

_tcsncicoll

_strnicoll

_mbsnbicoll

_wcsnicoll

_tcsnicoll

_strnicoll

_mbsnbicoll

_wcsnicoll

_tcsnicoll_l

_strnicoll_l

_mbsnbicoll_l

_wcsnicoll_l

Routine Required header Compatibility

_strnicoll, _strnicoll_l

<string.h>

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

_wcsnicoll, _wcsnicoll_l

<wchar.h> or <string.h>

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

_mbsnicoll, _mbsnicoll_l

<mbstring.h>

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For additional compatibility information, see Compatibility in the Introduction.

Community Additions

ADD
Show:
© 2014 Microsoft