You can use multiple delimiters with strtok
, the second argument is a C string with the list of delimiters in it, not just a single delimiter:
#include <stdio.h>
#include <string.h>
int main (void) {
char myStr[] = "A,B,C*D";
char *pChr = strtok (myStr, ",*");
while (pChr != NULL) {
printf ("%s ", pChr);
pChr = strtok (NULL, ",*");
}
putchar ('
');
return 0;
}
The output of that code is:
A B C D
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…