The wcsxfrm function transforms the string pointed to by ws2
and stores the resulting string in the array pointed to by ws1.
No more than maxchar wide characters, including the null wide
terminator, are placed into the array pointed to by ws1.
If the value of maxchar is less than the required size to store
the transformed string (including the terminating null), the
contents of the array pointed to by ws1 is indeterminate. In such
a case, the function returns the size of the transformed string.
If maxchar is 0, then, ws1 is allowed to be a NULL pointer, and
the function returns the required size of the ws1 array before
making the transformation.
The wide-character string comparison functions, wcscoll and
wcscmp, can produce different results given the same two wide-
character strings to compare. This is because wcscmp does a
straightforward comparison of the code point values of the
characters in the strings, whereas wcscoll uses the locale
information to do the comparison. Depending on the locale, the
wcscoll comparison can be a multipass operation, which is slower
than wcscmp.
The wcsxfrm function transforms wide-character strings in such
a way that if you pass two transformed strings to the wcscmp
function, the result is the same as passing the two original
strings to the wcscoll function. The wcsxfrm function is useful
in applications that need to do a large number of comparisons on
the same wide-character strings using wcscoll. In this case, it
may be more efficient (depending on the locale) to transform the
strings once using wcsxfrm and then use the wcscmp function to do
comparisons.