isalpha
描述 (Description)
它检查字符是否是字母。
声明 (Declaration)
以下是std :: isalpha的声明。
C++98
int isalpha ( int c );
C++11
int isalpha ( int c );
参数 (Parameters)
c - 要检查的字符,转换为int或EOF。
返回值 (Return Value)
它返回一个不等于零的值。
异常 (Exceptions)
No-throw guarantee - 此函数永远不会抛出异常。
例子 (Example)
在以下示例中为std :: isalpha。
#include <stdio.h>
#include <ctype.h>
int main () {
int i=0;
char str[]="C++";
while (str[i]) {
if (isalpha(str[i])) printf ("character %c is alphabetic\n",str[i]);
else printf ("character %c is not alphabetic\n",str[i]);
i++;
}
return 0;
}
样本输出应该是这样的 -
character C is alphabetic
character + is not alphabetic
character + is not alphabetic