1234567891011 |
- /* Create a function to extract the name of the subreddit from its URL.
- */
- std::string subReddit(std::string link) {
- // find the beginning of the subreddit "/r/"
- std::size_t subStart = link.find("/r/")+3;
- // save everything after "/r/"
- std::string subredditandJunk = link.substr(subStart);
- // save the text from the "/r/" to the next "/"
- return subredditandJunk.substr(0,subredditandJunk.find("/"));
- // return link.substr(subStart, link.size()-size_t(30));
- }
|