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);
}
The output will be httpwwwgooglecom.Thats is what i partially want. i also trying to find where are all the non-alphanumeric at.
Have a look at the C isalpha family of routines.