[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/string/wide/wcsxfrm [Back]  [Original]

std::wcsxfrm cppreference.com
cppreference.com

std::wcsxfrm

cppreference.com
<tbody> </tbody>
std::size_t wcsxfrm( wchar_t* dest, const wchar_t* src, std::size_t count );

, src, , , std::wcscmp , std::wcscoll C.

count , , , .

count 0, dest .

, , 1 + std::wcsxfrm(nullptr, src, 0).

, std::wcsxfrm std::wcscmp.

dest ,
src , ,
count

, .

#include <cwchar>
#include <iostream>

int main()
{
    std::setlocale(LC_ALL, "sv_SE.utf8");

    std::wstring in1 = L"\u00e5r";
    std::wstring out1(1 + std::wcsxfrm(nullptr, in1.c_str(), 0), L' ');
    std::wstring in2 = L"\u00e4ngel";
    std::wstring out2(1 + std::wcsxfrm(nullptr, in2.c_str(), 0), L' ');

    std::wcsxfrm(&out1[0], in1.c_str(), out1.size());
    std::wcsxfrm(&out2[0], in2.c_str(), out2.size());

    std::wcout << L"  : ";
    if (out1 < out2)
        std::wcout << in1 << L"  " << in2 << '\n';
    else
        std::wcout << in2 << L"  " << in1 << '\n';

    std::wcout << L"  : ";
    if (in1 < in2)
        std::wcout << in1 << L"  " << in2 << '\n';
    else
        std::wcout << in2 << L"  " << in1 << '\n';

}

:

  : r before ngel
  : ngel before r

, strcmp , strcoll
() []
[virtual]
,
:
transforms a string so that collation can be replaced by comparison
Google.
. .

(virtual protected std::collate -) []

() []
C wcsxfrm

Web Proxy Viewer  |  New URL  |  Original Page