c语言简单分割字符串:
#include<stdio.h>
#include<string.h>
int main(){
char oldstr[]="hahaha:hehehe-xixixi heiheihei";
char *newstr="";
char *splitstr=":- ";
newstr = strtok(oldstr,splitstr);
while(newstr !=NULL){
printf("%s\n",newstr);
newstr = strtok(NULL,splitstr);
}
return 0;
}