Udostępnij za pośrednictwem


isxdigit

Sprawdza, czy element w ustawieniach regionalnych jest znak używany do reprezentowania liczbę w postaci szesnastkowej.

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

Parametry

  • _Ch
    Element ma być testowane.

  • _Loc
    Ustawienia regionalne, zawierający element ma być badana.

Wartość zwracana

TRUE Jeśli element testowane jest znak używany do reprezentowania liczbę szesnastkową na liczbę; false Jeśli nie jest.

Uwagi

Funkcja szablonu zwraca use_facet<ctype< CharType>>(_Loc).is(ctype<CharType>::xdigit, _Ch).

Cyfry szesnastkowe użyć podstawa 16 do reprezentowania liczb, używając liczb od 0 do 9 oraz bez uwzględniania wielkości liter litery od A do F, aby reprezentować separatora dziesiętnego liczby od 0 do 15.

Przykład

// 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;
}

Dane wyjściowe

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.

Wymagania

Nagłówek:<ustawień regionalnych>

Przestrzeń nazw: std