wiki:hpp-locale
<locale>
<locale> provides locale-aware facets for character classification, collation, number/currency formatting, and time display. Most code avoids it in favor of simpler, more portable alternatives.
If you need to handle locale-specific collation or formatting in a GUI application, this is where to look; otherwise keep everything in the C locale or use explicit format strings.
Example
This example checks the current locale name and demonstrates switching to the C locale for output formatting.
// compile: g++ -std=c++11 -o localeexample localeexample.cpp // run: ./localeexample // description: check locale and use a facet #include <locale> #include <iostream> int main() { std::locale loc; std::cout << "name: " << loc.name() << "\n"; std::cout.imbue(std::locale("C")); std::cout << "3.14 in C locale: " << 3.14 << "\n"; return 0; }
wiki/hpp-locale.md · Last modified: by 127.0.0.1
