Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::locale::name

      From cppreference.com
      <cpp‎ |locale‎ |locale
       
       
       
      Localization library
       
       
      Defined in header<locale>
      std::string name()const;

      Returns the name of the locale, which is the name by which it is known to the operating system, such as"POSIX" or"en_US.UTF8" or"English_United States.1252". If the locale is not a copy of a system-supplied locale, the string"*" is returned.

      [edit]Return value

      The name of the locale or"*" if unnamed.

      [edit]Example

      Run this code
      #include <iostream>#include <locale>#include <string> int main(){std::locale loc(std::locale(), newstd::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';}

      Possible output:

      The default locale is CThe user's locale is en_US.UTF8A nameless locale is *

      [edit]See also

      constructs a new locale
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/locale/locale/name&oldid=160141"

      [8]ページ先頭

      ©2009-2025 Movatter.jp