std::strxfrm
De cppreference.com
![]() |
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
Definido en el archivo de encabezado <cstring>
|
||
std::size_t strxfrm( const char* dest, const char* src, std::size_t count ); |
||
Transforma la cadena de bytes de terminación nula apuntado por
src
en la forma de implantación definido de tal manera que comparar dos cadenas transformadas con std::strcmp da el mismo resultado que la comparación de las cadenas originales con std::strcoll, en la actual configuración regional 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.
You can help to correct and verify the translation. Click here for instructions.
Los caracteres
count
primero de la cadena transformada se escriben en destino, incluyendo el carácter nulo de terminación, y la longitud de la cadena completa transformada se devuelve, excluido el carácter nulo de terminación .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.
You can help to correct and verify the translation. Click here for instructions.
Si
count
es 0, entonces dest
se le permite ser un puntero 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.
You can help to correct and verify the translation. Click here for instructions.
Contenido |
[editar] Notas
La longitud correcta del búfer que puede recibir toda la cadena transformada es 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.
You can help to correct and verify the translation. Click here for instructions.
[editar] Parámetros
dest | - | puntero al primer elemento de la matriz donde se realizará la cadena transformada 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 | - | puntero al primer carácter de una cadena de bytes terminada en cero para 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 que se pueden escribir
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
La longitud de la cadena transformada, no incluyendo el carácter de terminación en nulo .
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.
You can help to correct and verify the translation. Click here for instructions.
[editar] Ejemplo
Ejecuta este código
#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'; }
Salida:
In the Czech locale: hrnec before chrt In lexicographical comparison: chrt before hrnec
[editar] Ver también
Transforma una cadena ancha para que wcscmp produzca el mismo resultado que wcscoll (función) | |
[virtual] |
transforma una cadena para que intercalación puede ser sustituido por comparación 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. (función miembro virtual protegida de std::collate )
|
Compara dos cadenas de acuerdo a la configuración regional actual (función) | |
Documentación de C para strxfrm
|