I want to split a char *string
based on multiple-character delimiter. I know that strtok()
is used to split a string but it works with single chara
EDIT : Considered suggestions from Alan and Sourav and written a basic code for the same .
#include
#include
int main (void)
{
char str[] = "This is abc test abc string";
char* in = str;
char *delim = "abc";
char *token;
do {
token = strstr(in,delim);
if (token)
*token = '\0';
printf("%s\n",in);
in = token+strlen(delim);
}while(token!=NULL);
return 0;
}