Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::iswctype

      From cppreference.com
      <cpp‎ |string‎ |wide
       
       
       
       
      Defined in header<cwctype>
      int iswctype(std::wint_t wc,std::wctype_t desc);

      Classifies the wide characterwc using the current C locale'sLC_CTYPE category identified bydesc.

      If the value ofwc is neither representable as awchar_t nor equal to the value of the macroWEOF, the behavior is undefined.

      Contents

      [edit]Parameters

      wc - the wide character to classify
      desc - theLC_CTYPE category, obtained from a call tostd::wctype

      [edit]Return value

      Non-zero if the characterwc has the property identified bydesc inLC_CTYPE facet of the current C locale, zero otherwise.

      [edit]Example

      Run this code
      #include <clocale>#include <cwctype>#include <iostream> bool classify(wchar_t wc,conststd::string& cat){return std::iswctype(wc,std::wctype(cat.c_str()));} int main(){std::setlocale(LC_ALL,"ja_JP.UTF-8");std::cout<<"The character\u6c34 is...\n";for(std::string s:{"digit","alpha","space","cntrl","jkanji"})std::cout<< s<<"? "<<std::boolalpha<< classify(L'\u6c34', s)<<'\n';}

      Output:

      The character 水 is...digit? falsealpha? truespace? falsecntrl? falsejkanji? true

      [edit]See also

      looks up a character classification category in the current C locale
      (function)[edit]
      C documentation foriswctype
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/string/wide/iswctype&oldid=153704"

      [8]ページ先頭

      ©2009-2025 Movatter.jp