Multiple Delimeter

how to break string in multiple delimeter. Give me an example to explain this part.

Please elaborate on this

like-- Given string: I Am Doing Coding Blocks Course and if i want to break the string for spaces then i will use strtok(s," ") but i want to break the string with multiple delimeter how to do that?

/* strtok example */
#include <stdio.h>
#include <string.h>

int main ()
{
  char str[] ="- Th,is, a samp-le string.";
  char * pch;
  printf ("Splitting string \"%s\" into tokens:\n",str);
  pch = strtok (str," ,.-");
  while (pch != NULL)
  {
    printf ("%s\n",pch);
    pch = strtok (NULL, " ,.-");
  }
  return 0;
}

In second argument add all the delimiters

THANK YOU, I GOT :blush::blush::blush::blush:

1 Like