std::numpunct::thousands_sep, std::numpunct::do_thousands_sep
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 <locale>
|
||
public: char_type thousands_sep() const; |
(1) | |
protected: char_type virtual do_thousands_sep() const; |
(2) | |
1)
función miembro pública, llama a la función
do_thousands_sep miembro de la clase más derivada .Original:
public member function, calls the member function
do_thousands_sep of the most derived class.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.
2)
devuelve el carácter que se utiliza como separador entre los grupos de dígitos al analizar o dar formato a los números enteros y partes integrantes de valores de punto flotante .
Original:
returns the character to be used as the separator between digit groups when parsing or formatting integers and integral parts of floating-point values.
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.
Valor de retorno
El objeto de
char_type tipo que se utiliza como separador de miles. Las especializaciones estándar de std::numpunct retorno ’,’ y L’,’ .Original:
The object of type
char_type to use as the thousands separator. The standard specializations of std::numpunct return ’,’ and L’,’.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.
Ejemplo
Ejecuta este código
#include <iostream>
#include <locale>
struct space_out : std::numpunct<char> {
char do_thousands_sep() const { return ' '; } // separate with spaces
std::string do_grouping() const { return "\001"; } // groups of 1 digit
};
int main()
{
std::cout << "default locale: " << 12345678 << '\n';
std::cout.imbue(std::locale(std::cout.getloc(), new space_out()));
std::cout << "locale with modified numpunct: " << 12345678 << '\n';
}
Salida:
default locale: 12345678
locale with modified numpunct: 1 2 3 4 5 6 7 8
Ver también
[virtual] |
proporciona el número de dígitos entre cada par de miles
separadores Original: provides the numbers of digits between each pair of thousands
separators 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) |