C
compboy
Does anyone know how to break string apart using c?
I know that we can use strtok to tokenize a string but by using that
we can only use 1 char as a delimiter.
like:
char delimiter[] = "*";
strtok(string, delimiter);
so how do you break string aparts if the delimiter is a string that
more than 1 char length?
likes delimiter[] = "***";
eg:
string = "this is the 1st string *** this is the 2nd string"
and break it into
string1 = "this is the 1st string"
string2 = "this is the 2nd string"
Thanks a lot.
I know that we can use strtok to tokenize a string but by using that
we can only use 1 char as a delimiter.
like:
char delimiter[] = "*";
strtok(string, delimiter);
so how do you break string aparts if the delimiter is a string that
more than 1 char length?
likes delimiter[] = "***";
eg:
string = "this is the 1st string *** this is the 2nd string"
and break it into
string1 = "this is the 1st string"
string2 = "this is the 2nd string"
Thanks a lot.