fork download
  1. #include <iostream> /* C++ iostream C++98/11 */
  2. #include <string> /* C++ strings C++98/11 */ /* RegEx Boost */
  3. #include <boost/algorithm/string.hpp>
  4. int main() {
  5. std::string str = "\\dir\\dir2\\dir4\\dir4\\dir6";
  6. auto itr = boost::find_nth(str, "\\", 4);
  7. if(itr.empty()) std::cout << "empty";
  8.  
  9.  
  10. }
  11.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty