C++ 使用boost字符串查找最后一次出现

C++ 使用boost字符串查找最后一次出现,c++,string,boost,C++,String,Boost,如何使用boost获得类似的功能 int idx = md.filepath.lastIndexOf('/'); md.title = md.filepath.right(md.filepath.length() - idx -1); md.title = md.title.left(md.title.length() - 4); 上面的代码(基于QT)查找不带扩展

如何使用boost获得类似的功能

  int idx = md.filepath.lastIndexOf('/');                                 
      md.title = md.filepath.right(md.filepath.length() - idx -1);            
      md.title = md.title.left(md.title.length() - 4);      

上面的代码(基于QT)查找不带扩展名的文件名,md是一个对象,filepath,title是QString。我浏览过boost的字符串方法,比如find_last,但它返回迭代器_range。我是boost新手,提前谢谢。

如果您只想进行文件名解析,那么最好使用该类。特别是以下方法:


该类提供了与
std::string
std::wstring
之间的转换。如果您只想进行文件名解析,那么最好使用该类。特别是以下方法:


该类提供了与
std::string
std::wstring
之间的转换,谢谢您的回复。我正在寻找一种不带扩展名的文件名获取方法。例如Filepath:/home/user/file.ext。我只想要'file'而不是'file.ext',这是
stem
函数提供给您的。谢谢您的回复。我正在寻找一种不带扩展名的文件名获取方法。例如Filepath:/home/user/file.ext。我只想要'file'而不是'file.ext',这就是
stem
函数提供给您的。