Espaços nominais
Variantes
Acções

std::strxfrm

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

 
 
Biblioteca cordas
Strings terminadas
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.
Cadeias de bytes
Multibyte cordas
Cordas de largura
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.
 
Cordas de terminação nula de bytes
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Manipulação personagem
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.
Conversões para formatos numéricos
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.
Manipulação de cadeia
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.
strxfrm
Exame String
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.
Manipulação de memória
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.
Diversos
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Definido no cabeçalho <cstring>
std::size_t strxfrm( const char* dest, const char* src, std::size_t count );
Transforma a seqüência de bytes terminada em nulo apontado por src na forma definida pela implementação de tal forma que comparar duas cadeias transformadas com std::strcmp dá o mesmo resultado que comparando as cordas originais com std::strcoll, na localidade C atual.
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.
Os personagens count primeiro da cadeia transformado são escritas para o destino, incluindo o caractere nulo de terminação, eo comprimento da corda cheia transformado é devolvido, excluindo o caractere nulo de terminação.
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, então dest é permitido ser um ponteiro nulo.
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.

Índice

[editar] Notas

O comprimento correto do buffer que pode receber toda a cadeia transformada é 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.

[editar] Parâmetros

dest -
ponteiro para o primeiro elemento da matriz, onde a cadeia de transformada será escrito
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 -
ponteiro para o primeiro caractere de uma seqüência de byte nulo terminada a se transformar
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 -
número máximo de caracteres a serem escritos
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.

[editar] Valor de retorno

O comprimento da corda transformado, não incluindo o caractere nulo de terminação-.
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.

[editar] Exemplo

#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';
 
}

Saída:

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

[editar] Veja também

transformar uma string de largura para que wcscmp produziria o mesmo resultado que 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.

(função) [edit]
[virtual]
transforma uma cadeia de caracteres de modo a que agrupamento pode ser substituído por comparação
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.

(virtual protegido of std::collate função de membro) [edit]
compara duas seqüências de acordo com a localidade
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.

(função) [edit]
Documentação C para strxfrm