std::strxfrm (3) - Linux Man Pages
Defined in header <cstring>
std::size_t strxfrm( char* dest, const char* src, std::size_t count );
Transforms the null-terminated byte string pointed to by src into the implementation-defined form such that comparing two transformed strings with std::strcmp gives the same result as comparing the original strings with std::strcoll, 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.
The behavior is undefined if the dest array is not large enough. The behavior is undefined if dest and src overlap.
If count is 0, then dest is allowed to be a null pointer.
The correct length of the buffer that can receive the entire transformed string is 1+std::strxfrm(nullptr, src, 0)
This function is used when making multiple locale-dependent comparisons using the same string or set of strings, because it is more efficient to use std::strxfrm to transform all the strings just once, and subsequently compare the transformed strings with std::strcmp.
dest - pointer to the first element of the array where the transformed string will be written
src - pointer to the first character of a null-terminated byte string to transform
count - maximum number of characters to be written
The length of the transformed string, not including the terminating null-character.
// Run this code
do_transform transforms a string so that collation can be replaced by comparison