strpbrk(...) vs. strcspn(...)

  • Thread starter Thread starter Guest
  • Start date Start date
What is the difference between these two functions?

strcspn returns a character position where strpbrk returns a pointer.
Other than that, if no character is found, strpbrk returns a null
pointer; IIRC, under the same circumstances strcspn returns the index
of the NUL at the end of the string (which is rarely useful).
 
They go back to the days of C when stupid, unrememberable names were common. The reason is there were no namespaces, classes or function overloading to keep things straight.
 
Back
Top