首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

iswalpha函数的有关问题

2012-11-07 
iswalpha函数的问题wchar_t aL中;我用iswalpha函数测试是否为字母,返回的结果不是0;请问这个问题怎么解

iswalpha函数的问题
wchar_t a=L'中';
我用iswalpha函数测试是否为字母,返回的结果不是0;
请问这个问题怎么解决呢?
谢谢大家。

[解决办法]

C/C++ code
#include <wctype.h>#include <stdio.h>int main(int argc, char* argv[]){    printf("%d\n", iswalpha(L'中'));    printf("%d\n", iswalpha(L'M'));    return 0;}//0//1024
[解决办法]
查MSDN是Windows程序员必须掌握的技能之一。

isalpha, iswalpha
int isalpha( int c );

int iswalpha( wint_t c );

Each of these routines returns true if c is a particular representation of an alphabetic character.

Routine Required Header Compatibility 
isalpha <ctype.h> ANSI, Win 95, Win NT 
iswalpha <ctype.h> or <wchar.h> ANSI, Win 95, Win NT 


For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version 
LIBCMT.LIB Multithread static library, retail version 
MSVCRT.LIB Import library for MSVCRT.DLL, retail version 


Return Value

isalpha returns a non-zero value if c is within the ranges A – Z or a – z. iswalpha returns a non-zero value only for wide characters for which iswupper or iswlower is true, that is, for any wide character that is one of an implementation-defined set for which none of iswcntrl, iswdigit, iswpunct, or iswspace is true. Each of these routines returns 0 if c does not satisfy the test condition.

The result of the test condition for the isalpha function depends on the LC_CTYPE category setting of the current locale; see setlocale for more information. For iswalpha, the result of the test condition is independent of locale.

Parameter

c

Integer to test

Generic-Text Routine Mappings

TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined 
_istalpha isalpha _ismbcalpha iswalpha 


Character Classification Routines | Locale Routines | is, isw Function Overview

热点排行