◐ Shell
clean mode source ↗

std::strxfrm - cppreference.com

Da cppreference.com.

Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.

La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui.

Click here for the English version of this page

<metanoindex/>

<tbody> </tbody>

Elemento definito nell'header

<cstring>

std::size_t strxfrm( const char* dest, const char* src, std::size_t count );

Trasforma la stringa null-terminated byte puntata da src nel nostro modulo di attuazione definiti in modo tale che confrontare due stringhe trasformate con std::strcmp dà lo stesso risultato confrontando le stringhe originali con std::strcoll, nella versione locale corrente C.

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.

I caratteri count prima della stringa trasformate vengono scritte destinazione, compreso il carattere nullo finale, e la lunghezza della stringa completa trasformata viene restituito, escluso il carattere nullo finale.

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.

Se count è 0, allora dest è permesso di essere un puntatore nullo.

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.

Note

La lunghezza corretta del buffer che può ricevere l'intera stringa è trasformato 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.

Parametri

dest -

puntatore al primo elemento della matrice in cui la stringa trasformata verrà scritto

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 -

puntatore al primo carattere di una stringa con terminazione null byte da trasformare

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 -

il numero massimo di caratteri da scrivere

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.

Valore di ritorno

La lunghezza della stringa trasformato, escluso il carattere di terminazione null.

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.

Esempio

#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

Vedi anche

trasformare una stringa larga in modo che wcscmp produrrebbe lo stesso risultato wcscoll

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.


(funzione) [modifica]

[virtuale]

trasforma una stringa in modo che confronto può essere sostituito da confronto

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.


(virtuale protetto funzione of std::collate membro) [modifica]

confronta due stringhe in accordo con i parametri locali

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.


(funzione) [modifica]

C documentation for strxfrm