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

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -