extracting string occurrence in c
Posted
by David78
on Stack Overflow
See other posts from Stack Overflow
or by David78
Published on 2010-04-04T05:08:01Z
Indexed on
2010/04/04
5:13 UTC
Read the original article
Hit count: 210
I have a string from a text file that look something like this:
long_str = "returns between paragraphs 20102/34.23" - 9203 1232 "test" "basic HTML"
Note: Quotes are part of the string.
int match(char *long_str){
char * str;
if ((str = strchr(long_str, '"')) != NULL) str++; // last " ?
else return 1;
return 0;
}
Using strstr I'm trying to get the whole substring between the last two quotes: "basic HTML". I'm just not quite sure what would be a good and efficient way of getting that match. I'm open to any other ideas on how to approach this. Thanks
© Stack Overflow or respective owner