Comp sci: C programming: strpbrk
Self-tutoring about C programming: the tutor mentions how to get the suffix of a string.
C string functions seem tuned to get a prefix of a string, but not the suffix. Yet, with a pointer, the suffix is easy from the prefix.
Let’s imagine you have the string
“She doesn’t believe in intermittent fasting because….”
You want, from it, to extract everything after “doesn’t”. Here’s how you might:
char sentence=”She doesn’t believe in intermittent fasting because….”;
p=strpbrk(sentence, “'”);//the apostrophe is the target
p+=strlen(“'t “); //strlen: string length
The output, hopefully:
believe in intermittent fasting because….
Kernighan, Brian and Dennis Ritchie. The C Programming Language. New Jersey: Prentice Hall, 1988.Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.