Locale-Sensitive C/C++ Collation Function
size_t strxfrm(char* strDest, const char* strSource, size_t count);
size_t wcsxfrm(wchar_t* strDest, const wchar_t* strSource, size_t count);
size_t _tcsxfrm(TCHAR* strDest, const TCHAR* strSource, size_t count);
Internationalization (I18n) Function Overview
The strxfrm function transforms the strSource string by converting each character to its collation order equivalent, using the LC_COLLATE category of the current locale. The equivalent character is then copied into strDest . Thus, after transforming two different strings with strxfrm , the transformed strings can be compared by calling strcmp to obtain the same result as calling strcoll on the original strings.
No more than count characters are stored in strDest , including the trailing null character. If count is 0, strDest can be null.
The return value is the number of transformed characters written to strDest .
wcsxfrm is the wide-character version of strxfrm , utilizing wide-character string arguments.
_tcsxfrm is the Windows-only Generic version of the function; with the _MBCS or _UNICODE compiler flags determining its mapping to either strxfrm or wcsxfrm .
I18n Issues
Use the appropriate version of the function as required for internationalization support.
The locale for which this function draws its collation rules can be set via setlocale .
Recommended Replacements*
*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.
Performance Notes
The advantage of using strxfrm for character collation over strcoll lies in performance. The strcoll function is easier to use (just one call) but is typically slower than strcmp .
Collation Functions
|