LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Заголовочный файл <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*/ |
||
Каждый из этих констант макро расширить до целого константные выражения с различными значениями, которые являются подходящими для использования в качестве первого аргумента 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
|
выбирает весь языка 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
|
выбирает сортировки категорий языка 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
|
выбирает категорию характер классификации языка 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
|
выбирает денежную категории форматирования языка 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
|
выбирает числовой категории форматирования языка 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
|
выбирает категорию время форматирования языка 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. |
Дополнительные константы макросов, имена которых начинаются с
LC_ следуют по крайней мере одной заглавной буквы, могут быть определены в <clocale>. Например, спецификация POSIX требует LC_MESSAGES и GNU C библиотека определяет дополнительно LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, и 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.
[править] Пример
#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); }
Вывод:
Number: 3,14 Date: 月曜日 2011年12月19日 18時04分40秒
[править] См. также
| получает и устанавливает текущий стандарт C Original: gets and sets 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. (функция) | |
| Набор полиморфных аспекты, которые инкапсулируют культурные различия Original: set of polymorphic facets that encapsulate cultural differences The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (класс) | |