다음을 통해 공유


iscntrl

요소에 로캘 제어 문자 인지 여부를 테스트 합니다.

template<Class CharType>
   bool iscntrl(
      CharType _Ch, 
      const locale& _Loc
   )

매개 변수

  • _Ch
    테스트 요소입니다.

  • _Loc
    테스트 하는 요소를 포함 하는 로캘.

반환 값

true 이면 경우 테스트 요소 제어 문자입니다. false 이면 되지 않은 경우.

설명

템플릿 함수가 반환 use_facet<ctype<CharType> >(_Loc).is(ctype<CharType>::cntrl, _Ch).

예제

// locale_iscntrl.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>

using namespace std;

int main( )   
{
   locale loc ( "German_Germany" );
   bool result1 = iscntrl ( 'L', loc );
   bool result2 = iscntrl ( '\n', loc );
   bool result3 = iscntrl ( '\t', loc );

   if ( result1 )
      cout << "The character 'L' in the locale is "
           << "a control character." << endl;
   else
      cout << "The character 'L' in the locale is "
           << " not a control character." << endl;

   if ( result2 )
      cout << "The character-set 'backslash-n' in the locale\n is "
           << "a control character." << endl;
   else
      cout << "The character-set 'backslash-n' in the locale\n is "
           << " not a control character." << endl;

   if ( result3 )
      cout << "The character-set 'backslash-t' in the locale\n is "
           << "a control character." << endl;
   else
      cout << "The character-set 'backslash-n' in the locale \n is "
           << " not a control character." << endl;
}

Output

The character 'L' in the locale is  not a control character.
The character-set 'backslash-n' in the locale
 is a control character.
The character-set 'backslash-t' in the locale
 is a control character.

요구 사항

헤더: <locale>

네임 스페이스: std