c 判断是否为 字母或数字(iswalnum example)

 

#include <stdio.h>
#include <wctype.h>
int main ()
{
    int i;
    wchar_t str[] = L"c3p。o...";
    i=0;
    while (iswalnum(str[i])){
        i++;
    }
    printf("The first %d characters are alphanumeric.\n",i);
    return 0;
}

输出

The first 3 characters are alphanumeric.

 

posted @ 2019-05-20 16:16  anobscureretreat  阅读(286)  评论(0编辑  收藏  举报