C語言wctype頭文件(wctype.h)中iswxdigit函數的用法及代碼示例。
用法:
int iswxdigit (wint_t c);
檢查寬字符是否為十六進製數字
A 十六進製數字是以下任何一項:0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
此函數的等價於寬字符isxdigit(<cctype>): 如果c翻譯為wctob到一個角色isxdigit是的,該函數也始終將其視為十六進製數字字符。
在C++中,此函數的locale-specific模板版本(isxdigit)存在於標題中<locale>適用於所有字符類型。
參數
- c
- 要檢查的寬字符,強製轉換為wint_t, 或者WEOF。
wint_t是整數類型。
返回值
不同於零的值(即,true)如果確實c是一個十六進製數字。零(即false) 否則。示例
/* isxdigit example */
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
int main ()
{
wchar_t str[] = L"ffff";
long int number;
if (iswxdigit(str[0]))
{
number = wcstol (str,NULL,16);
wprintf (L"The hexadecimal number %lx is %ld.\n",number,number);
}
return 0;
}
輸出:
The hexadecimal number ffff is 65535. |
相關用法
- C語言 iswalnum用法及代碼示例
- C語言 iswalpha用法及代碼示例
- C語言 iswblank用法及代碼示例
- C語言 iswcntrl用法及代碼示例
- C語言 iswdigit用法及代碼示例
- C語言 iswgraph用法及代碼示例
- C語言 iswlower用法及代碼示例
- C語言 iswprint用法及代碼示例
- C語言 iswpunct用法及代碼示例
- C語言 iswspace用法及代碼示例
- C語言 iswupper用法及代碼示例
- C語言 towlower用法及代碼示例
- C語言 towupper用法及代碼示例
- C語言 iswctype用法及代碼示例
- C語言 towctrans用法及代碼示例
- C語言 wctrans用法及代碼示例
- C語言 wctype用法及代碼示例
注:本文由純淨天空篩選整理自C標準庫大神的英文原創作品 C iswxdigit function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。