Skip to content

Instantly share code, notes, and snippets.

@RSquaredSoftware
Last active August 29, 2015 14:10
Show Gist options
  • Save RSquaredSoftware/2ac7767e199a101fa422 to your computer and use it in GitHub Desktop.
Save RSquaredSoftware/2ac7767e199a101fa422 to your computer and use it in GitHub Desktop.
std::vector<int> authors;
void parser::findAuthors(std::string json, int startPos = 0, std::string searchKey){
// Look for the key i.e. author, kind, data etc.
int key = json.substr(searchKey, startPos);
// If it was found
if (key > 0) {
// Add the location of the found author into the vector
authors.push_back(key);
// Print the location to share with the world
std::cout << key << std::endl;
// Recrusively do the same thing except starting after the current incident of the key
findAuthors(json, key + 1, searchKey);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment