wcsxfrm

From cppreference.com
< c‎ | string‎ | wide
Defined in header <wchar.h>
size_t wcsxfrm( wchar_t* dest, const wchar_t* src, size_t count );
(until C99)
(since C95)
size_t wcsxfrm( wchar_t* restrict dest, const wchar_t* restrict src, size_t count );
(since C99)

Transforms the null-terminated wide string pointed to by src into the implementation-defined form such that comparing two transformed strings with wcscmp gives the same result as comparing the original strings with wcscoll, in the current C locale.

The first count characters of the transformed string are written to destination, including the terminating null character, and the length of the full transformed string is returned, excluding the terminating null character.

If count is 0, then dest is allowed to be a null pointer.

Notes

The correct length of the buffer that can receive the entire transformed string is 1+wcsxfrm(NULL, src, 0)

This function is used when making multiple locale-dependent comparisons using the same wide string or set of wide strings, because it is more efficient to use wcsxfrm to transform all the strings just once, and subsequently compare the transformed wide strings with wcscmp.

Parameters

dest - pointer to the first element of a wide null-terminated string to write the transformed string to
src - pointer to the null-terminated wide character string to transform
count - maximum number of characters to output

Return value

The length of the transformed wide string, not including the terminating null-character.