isxdigit
測試一個項目中的地區設定是用來表示十六進位數字。
template<Class CharType>
bool isxdigit(
CharType _Ch,
const locale& _Loc
)
參數
_Ch
要測試的項目。_Loc
包含項目的地區設定要測試的。
傳回值
true ,如果測試的項目是用來表示十六進位數字, false ,否則會傳回。
備註
樣板函式傳回 use_facet<ctype< CharType> > (_Loc)。是(ctype<CharType>::xdigit, _Ch)。
表示數字的十六進位數字,用來使用Base 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.
需求
標題: <locale>
命名空間: std