C++: how to judge if the path of the file start with a given path -
i have path, example, named
/my/path/test/mytestpath
, , want judge if start given path, example
/my/path
std::string::find() returns index @ string found, index of 0 being start of string:
std::string path("/my/path/test/mytestpath");  // check if 'path' begins "/my/path/". // if (0 == path.find("/my/path/")) {     // 'path' starts "/my/path". } 
Comments
Post a Comment