Internationalization and localization tools


Locale-Sensitive C/C++ Collation Function

int _strnicoll(const char *string1, const char string2, size_t count);

int _mbsnbicoll(const unsigned char *string1, const unsigned char string2, size_t count);

int _mbsnicoll(const unsigned char *string1, const unsigned char string2, size_t count);

int _wcsnicoll(const wchar_t *string1, const wchar_t string2, size_t count);

int _tcsnicoll(const _TXCHAR *string1, const _TXCHAR string2, size_t count);

int _tcsncicoll(const _TXCHAR *string1, const _TXCHAR string2, size_t count);

Internationalization (I18n) Function Overview

The _strnicoll function compares count specified characters in two strings, ignoring case, using the currently selected code page.

_mbsnbicoll is the multibyte character version that compares bytes in the multibyte strings; whereas _mbsnicoll compares multibyte characters in the strings.

_wcsnicoll is the wide-character version that compares wide-character strings.

_tcsnicoll and _tcsncicoll are the Generic versions of the function; when the Windows _MBCS compiler flag is set, _tcsnicoll maps to _mbsnbicoll and _tcsncicoll maps to _mbsnicoll. When the Windows _UNICODE flag is set, the Generic functions both map to _wcsnicoll.

I18n Issues

Use the appropriate version of the function as required for internationalization support, noting the following:

The single-byte version of the function, _strnicoll, should not be used for collation because it will only work with single-byte characters. Instead, the appropriate multibyte, wide or generic version should be called.

Ensure that the count argument value is correct for the chosen platform and function call; the number of bytes for _mbsnbicoll, the number of multibyte characters for _mbsnicoll, and the number of wide characters for _wcsnicoll. See Locale-Sensitive Length Functions for a discussion on multibyte and wide character sizes.

The locale for which this function draws its collation rules can be set via setlocale.

In the case of multibyte characters, ensure that the multibyte code page is set correctly before calling the multibyte or generic version of this function. See _setmbcp for more information on setting up the multibyte code page.

Recommended Function Replacements

Collation Functions

 

Lingoport internationalization and localization services and software