LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME
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 <clocale>
|
||
#define LC_ALL /*implementation defined*/ |
||
#define LC_COLLATE /*implementation defined*/ |
||
#define LC_CTYPE /*implementation defined*/ |
||
#define LC_MONETARY /*implementation defined*/ |
||
#define LC_NUMERIC /*implementation defined*/ |
||
#define LC_TIME /*implementation defined*/ |
||
Cada una de las constantes macro anterior para expandir enteros expresiones constantes con valores distintos que son adecuados para uso como el primer argumento de std::setlocale .
Original:
Each of the above macro constants expand to integer constant expressions with distinct values that are suitable for use as the first argument of std::setlocale.
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.
Constant
Original: Constant The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Explanation |
LC_ALL
|
selecciona toda la configuración regional C
Original: selects the entire C locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
LC_COLLATE
|
selecciona la categoría de cotejo de la configuración regional C
Original: selects the collation category of the C locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
LC_CTYPE
|
selecciona la categoría de clasificación de caracteres de la configuración regional C
Original: selects the character classification category of the C locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
LC_MONETARY
|
selecciona la categoría de formato monetario del entorno nacional C
Original: selects the monetary formatting category of the C locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
LC_NUMERIC
|
selecciona la categoría de formato numérico del entorno nacional C
Original: selects the numeric formatting category of the C locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
LC_TIME
|
selecciona la categoría de formato de tiempo de la configuración regional C
Original: selects the time formatting category of the C locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Constantes adicionales macro, con nombres que comienzan con
LC_ seguido por al menos una letra mayúscula, se puede definir en <clocale>. Por ejemplo, la especificación POSIX requiere LC_MESSAGES y la biblioteca C de GNU, además, define LC_PAPER, LC_NAME, LC_MEASUREMENT LC_ADDRESS, LC_TELEPHONE, y LC_IDENTIFICATION .Original:
Additional macro constants, with names that begin with
LC_ followed by at least one uppercase letter, may be defined in <clocale>. For example, the POSIX specification requires LC_MESSAGES and the GNU C library additionally defines LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, and LC_IDENTIFICATION.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 <cstdio>
#include <clocale>
#include <ctime>
#include <cwchar>
int main()
{
std::setlocale(LC_ALL, "en_US.UTF-8"); // the C locale will be the UTF-8 enabled English
std::setlocale(LC_NUMERIC, "de_DE"); // decimal dot will be German
std::setlocale(LC_TIME, "ja_JP"); // date/time formatting will be Japanese
wchar_t str[100];
std::time_t t = std::time(NULL);
std::wcsftime(str, 100, L"%A %c", std::localtime(&t));
std::wprintf(L"Number: %.2f\nDate: %Ls\n", 3.14, str);
}
Salida:
Number: 3,14
Date: 月曜日 2011年12月19日 18時04分40秒
Ver también
| Obtiene y establece la configuración regional actual de C. (función) | |
| Conjunto de facetas polimórficas que encapsulan las diferencias culturales. (clase) |