Namensräume
Varianten
Aktionen

std::strxfrm

Aus cppreference.com
< cpp‎ | string‎ | byte

 
 
Strings Bibliothek
Null-terminierte Strings
Original:
Null-terminated strings
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Byte-Strings
Multibyte-Strings
Wide Strings
Classes
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_string
char_traits
 
Null-terminierte Byte-Strings
Funktionen
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Character Manipulation
Original:
Character manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Umwandlungen in numerische Formate
Original:
Conversions to numeric formats
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
String-Manipulation
Original:
String manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strcpy
strncpy
strcat
strncat
strxfrm
String Prüfung
Original:
String examination
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Speicher Manipulation
Original:
Memory manipulation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
memchr
memcmp
memset
memcpy
memmove
Verschiedenes
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
strerror
 
Defined in header <cstring>
std::size_t strxfrm( const char* dest, const char* src, std::size_t count );
Verwandelt den nullterminierten byte String, auf den src in die Implementierung definiert Form, so dass den Vergleich zweier verwandelt Strings mit std::strcmp das gleiche Ergebnis wie das Vergleichen der ursprünglichen Strings mit std::strcoll in der aktuellen C locale .
Original:
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 text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Die ersten count Zeichen des transformierten Kette sind Ziel geschrieben, einschließlich des abschließenden Null-Zeichen, und die Länge des vollständigen verwandelt String zurückgegeben, ohne das abschließende Nullzeichen .
Original:
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 text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn count ist 0, dann dest darf ein NULL-Zeiger sein .
Original:
If count is 0, then dest is allowed to be a null pointer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Notes

Die richtige Länge des Puffers, der den gesamten transformierten String empfangen kann 1+std::strxfrm(NULL, src, 0)
Original:
The correct length of the buffer that can receive the entire transformed string is 1+std::strxfrm(NULL, src, 0)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Parameter

dest -
Zeiger auf das erste Element des Arrays, wo der transformierten Kette geschrieben werden
Original:
pointer to the first element of the array where the transformed string will be written
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
src -
Zeiger auf das erste Zeichen eines null-terminierte Byte-String zu verwandeln
Original:
pointer to the first character of a null-terminated byte string to transform
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
count -
maximale Anzahl von Zeichen geschrieben werden
Original:
maximum number of characters to be written
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Rückgabewert

Die Länge des transformierten Kette, ohne das abschließende Null-Zeichen .
Original:
The length of the transformed string, not including the terminating null-character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Beispiel

#include <iostream>
#include <iomanip>
#include <cstring>
 
int main()
{
    std::setlocale(LC_COLLATE, "cs_CZ.iso88592");
 
    std::string in1 = "hrnec";
    std::string out1(1+std::strxfrm(nullptr, in1.c_str(), 0), ' ');
    std::string in2 = "chrt";
    std::string out2(1+std::strxfrm(nullptr, in2.c_str(), 0), ' ');
 
    std::strxfrm(&out1[0], in1.c_str(), out1.size());
    std::strxfrm(&out2[0], in2.c_str(), out2.size());
 
    std::cout << "In the Czech locale: ";
    if(out1 < out2)
         std::cout << in1 << " before " << in2 << '\n';
    else
         std::cout << in2 << " before " << in1 << '\n';
 
    std::cout << "In lexicographical comparison: ";
    if(in1 < in2)
         std::cout << in1 << " before " << in2 << '\n';
    else
         std::cout << in2 << " before " << in1 << '\n';
 
}

Output:

In the Czech locale: hrnec before chrt
In lexicographical comparison: chrt before hrnec

[Bearbeiten] Siehe auch

Transformation ein breites String, so dass wcscmp das gleiche Ergebnis wie wcscoll erzeugen würde
Original:
transform a wide string so that wcscmp would produce the same result as wcscoll
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion) [edit]
[virtuell]
wandelt einen String, so dass collation durch Vergleich ersetzt werden können
Original:
transforms a string so that collation can be replaced by comparison
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(virtuellen geschützten Member-Funktion of std::collate) [edit]
vergleicht zwei Strings in Übereinstimmung mit dem aktuellen Gebietsschema
Original:
compares two strings in accordance to the current locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Funktion) [edit]
C documentation for strxfrm