2.14.18 strpbrk


char *strpbrk(const char *str1, const char *str2);

Finds the first character in the string str1 that matches any character specified in str2.

A pointer to the location of this character is returned. A null pointer is returned if no character in str2 exists in str1.



int main(void)
  char string[]="Hi there, Chip!";
  char *string_ptr;

  while((string_ptr=strpbrk(string," "))!=NULL)

  printf("New string is \"%s\".\n",string);
  return 0;

The output should result in every space in the string being converted to a dash (-).