e1a3e66b150100bcb49a4d995aeb38ff95fe43d2 kent Thu Jun 8 23:28:29 2017 -0700 Made nextStringBetween for when you are looking repeatedly for a pattern. diff --git src/inc/common.h src/inc/common.h index 457b767..e5a218c 100644 --- src/inc/common.h +++ src/inc/common.h @@ -801,30 +801,36 @@ /* Return TRUE if first word in line is same as firstWord as delimited by delimit. Comparison is case sensitive. Delimit of ' ' uses isspace() */ #define stringIn(needle, haystack) strstr(haystack, needle) /* Returns position of needle in haystack or NULL if it's not there. */ /* char *stringIn(char *needle, char *haystack); */ char *rStringIn(char *needle, char *haystack); /* Return last position of needle in haystack, or NULL if it's not there. */ char *stringBetween(char *start, char *end, char *haystack); /* Return string between start and end strings, or NULL if * none found. The first such instance is returned. * String must be freed by caller. */ +char *nextStringBetween(char *start, char *end, char **pHaystack); +/* Return next string that occurs between start and end strings + * starting seach at *pHaystack. This will update *pHaystack to after + * end, so it can be called repeatedly. Returns NULL when + * no more to be found*/ + char * findWordByDelimiter(char *word,char delimit, char *line); /* Return pointer to first word in line matching 'word' and delimited by 'delimit'. Comparison is case sensitive. Delimit of ' ' uses isspace() */ boolean endsWith(char *string, char *end); /* Returns TRUE if string ends with end. */ char lastChar(char *s); /* Return last character in string. */ void trimLastChar(char *s); /* Erase last character in string. */ char *lastNonwhitespaceChar(char *s); // Return pointer to last character in string that is not whitespace.