C++ 本地化库 - 名称



描述

它用于获取语言环境名称并以实现特定方式返回语言环境的名称。

声明

以下是 std::locale::name 的声明。

C++98

	
string name() const;

C++11

string name() const;

参数

返回值

它返回一个包含语言环境名称的字符串,如果它没有名称则返回“*”。

异常

强保证 - 如果抛出异常,则没有影响。

数据竞争

访问语言环境对象。

示例

以下示例说明了 std::locale::name。

#include <iostream>
#include <locale>

int main () {
   std::locale loc;

   std::cout << "The global locale should be : " << loc.name() << '\n';

   return 0;
}

让我们编译并运行上述程序,这将产生以下结果:

The global locale should be : C
locale.htm
广告

© . All rights reserved.