C library function strxfrm()
C library function strxfrm()
#include <iostream>
#include <cstring>
#include <clocale>
using namespace std;
int main()
{
setlocale(LC_COLLATE, "cs_CZ.UTF-8");
const char* s1 = "hrnec";
const char* s2 = "chrt";
char t1[20], t2[20];
cout << "strcoll returned " << strcoll(s1,s2) << endl;
cout << "Before transformation, " << "strcmp returned " << strcmp(s1,s2) << endl;
strxfrm(t1,s1,10);
strxfrm(t2,s2,10);
cout << "After transformation, " << "strcmp returned " << strcmp(t1,t2) << endl;
return 0;
}
Output
strcoll returned -1
Before transformation, strcmp returned 1
After transformation, strcmp returned -1