Extract string between two specific strings in C
问题 How do you extract strings between two specified strings? For Example: <title>Extract this</title> . Is there a simple way to get it using strtok() or anything simpler? EDIT: The two specified strings are <title> and </title> and the string extracted is Extract this . 回答1: Search for the first sub string using strstr() . If found, save the array index of the sub string From there, search for the next sub string. If found, everything between [ [start of sub string 1] + [length of sub string 1]