C++ Locale Library - name
Description
It used to get a locale name and returns the name of the locale, in an implementation-specific manner.
Declaration
Following is the declaration for std::locale::name.
C++98
string name() const;
C++11
string name() const;
Parameters
none
Return Value
It returns a string with the name of the locale, or with "*" if it has no name.
Exceptions
Strong guarantee − if an exception is thrown, there are no effects.
Data races
The locale object is accessed.
Example
In below example explains about std::locale::name.
#include <iostream>
#include <locale>
int main () {
std::locale loc;
std::cout << "The global locale should be : " << loc.name() << '\n';
return 0;
}
Let us compile and run the above program, this will produce the following result −
The global locale should be : C
locale.htm
Advertisements