isxdigit

测试一个元素来包装区域设置是否是字符表示十六进制数字。

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

参数

  • _Ch
    元素是测试。

  • _Loc
    包含元素的区域设置进行测试。

返回值

true,则测试的元素是用于字符表示十六进制数字;false,则不是。

备注

模板函数 use_facet<ctype<返回 CharType> >(_Loc)。(ctype<CharType>或xdigit,_Ch)。

表示数字的十六进制数字使用基 16,使用第 0 至 9 正不区分大小写字母表示十进制数的 A 到 F 0 到 15。

示例

// 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.

要求

页眉: <区域设置>

命名空间: std