I’m trying to replicate the same functionally as JavaScript’s sub string to extract string from string by given the sub string from / to pos’s . How should I continue this function after I gut the location from and to?
std::string& UT::extractid(std::string& url)
{
std::vector< std::string > tokens;
std::string id = "";
tokens = split(url,'v=');
video_id = tokens.at(1);
if(video_id.length()>2)
{
string::size_type ampersandPosition = video_id.find('&', 0 );
if( ampersandPosition != string::npos ) {
cout << "Found at " << loc << endl;
} else {
cout << "Didn't find " << endl;
}
}
return video_id;
}
Instead of
do this: