名前空間
変種

std::locale::name

提供: cppreference.com
 
 
 
 
<tbody> </tbody>
ヘッダ <locale> で定義
std::string name() const;

ロケールの名前を返します。 これは "POSIX"、 "en_US.UTF8"、 "English_United States.1252" などの、オペレーティングシステムに知られている名前です。 ロケールがシステム供給ロケールのコピーでない場合は、文字列 "*" が返されます。

戻り値

ロケールの名前、または名前がない場合は "*"。

#include <locale>
#include <iostream>
#include <string>

int main()
{
    std::locale loc(std::locale(), new std::ctype<char>);
    std::cout << "The default locale is " << std::locale().name() << '\n'
              << "The user's locale is " << std::locale("").name() << '\n'
              << "A nameless locale is " << loc.name() << '\n';
}

出力:

The default locale is C
The user's locale is en_US.UTF8
A nameless locale is *

関連項目

新しいロケールを構築します
(パブリックメンバ関数) [edit]