isxdigit

Testet, ob ein Element in einem Gebietsschema ein Zeichen besteht, das verwendet wird, um eine Hexadezimalzahl darzustellen.

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

Parameter

  • _Ch
    Das zu testenden Element.

  • _Loc
    Das Gebietsschema, das das zu testenden Element enthält.

Rückgabewert

true, wenn das Element, das getestet wird, ein Zeichen ist, das verwendet wird, um eine Hexadezimalzahl darzustellen, false, wenn nicht ist.

Hinweise

Die Vorlagenfunktion gibt use_facet<ctype< CharType> >(_Loc).is(ctype<CharType>::xdigit, _Ch) zurück.

Hexadezimalziffern stellen Zahlen mithilfe von Basis 16 dar und verwenden die Zahlen 0 bis 9 plus Groß-/Kleinschreibung nicht beachtende Buchstaben A bis F, um die Dezimalzahlen 0 bis 15 darzustellen.

Beispiel

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

using namespace std;

int main( )   
{
   locale loc ( "German_Germany" );
   bool result1 = isxdigit ( '5', loc );
   bool result2 = isxdigit ( 'd', loc );
   bool result3 = isxdigit ( 'q', loc );

   if ( result1 )
      cout << "The character '5' in the locale is "
           << "a hexidecimal digit-character." << endl;
   else
      cout << "The character '5' in the locale is "
           << " not a hexidecimal digit-character." << endl;

   if ( result2 )
      cout << "The character 'd' in the locale is "
           << "a hexidecimal digit-character." << endl;
   else
      cout << "The character 'd' in the locale is "
           << " not a hexidecimal digit-character." << endl;

   if ( result3 )
      cout << "The character 'q' in the locale is "
           << "a hexidecimal digit-character." << endl;
   else
      cout << "The character 'q' in the locale is "
           << " not a hexidecimal digit-character." << endl;
}

Output

The character '5' in the locale is a hexidecimal digit-character.
The character 'd' in the locale is a hexidecimal digit-character.
The character 'q' in the locale is  not a hexidecimal digit-character.

Anforderungen

Header: <locale>

Namespace: std