首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::locale::name

Defined in header <locale>

?

?

std::string name() const;

?

?

返回区域设置的名称,该名称是操作系统知道它的名称,例如“POSIX”或“en”。[医]美国UTF 8或“英语”[医]1252“。如果区域设置不是系统提供的区域设置的副本,则字符串“%2A“被归还。

返回值

地区名称或“%2A“”如果不知道名字的话。

二次

代码语言:javascript
复制
#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';
}

二次

产出:

二次

代码语言:javascript
复制
The default locale is C
The user's locale is en_US.UTF8
A nameless locale is *

二次

另见

(constructor)

constructs a new locale (public member function)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com