看看string.h中的strtok和strlen
#include <stdio.h>
#include <string.h>
int main(void) {
char url[] = "www.google.com";
char *token;
token = strtok(url, ".");
while(token != NULL) {
printf("%s -%d\n", token, (int)strlen(token));
token = strtok(NULL, ".");
}
return 0;
}