如何找到用C非字母数字 [英] how to find non-alphanumeric in C

查看:92
本文介绍了如何找到用C非字母数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从C.this字符串分隔非字母数字和字母数字是我目前的code,但如果我用这个,它将只检测所有字母数字,而在非字母数字就会返回null。所以我不能检测出在什么指标都处于非字母数字。

im trying to separate non-alphanumeric and alphanumeric from a string in C.this is my current code,but if i use this,it will detect all alphanumeric only,while at non-alphanumeric it will return null.so i cant detect at what index are all the non-alphanumeric at.

    char data[] = "http://www.google.com";
    char key[]  = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    char *find;

    find = strpbrk(data,key);
    while(find != NULL){
        printf("%c",*find);
        find = strpbrk(find+1,key);        
    }

输出将httpwwwgooglecom.Thats就是我想要的部分。我也试图寻找哪里都是在非字母数字字符。

The output will be httpwwwgooglecom.Thats is what i partially want. i also trying to find where are all the non-alphanumeric at.

推荐答案

看一看在C 因而isalpha 例程的家庭。

Have a look at the C isalpha family of routines.

这篇关于如何找到用C非字母数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆