使用c ++搜索字符串的出现次数

raa*_*van 0 c++ string algorithm stl substring

我需要在字符串中找到字符串的出现.在c ++中有没有找到函数?例如,如果我有一个字符串example/example/example/a/a,如何获得一些字符串example,在这种情况下是3?

Lea*_*elo 7

是的,有一个函数可以在字符串中查找内容.;-)

您可以通过查看API 找到这个以及更多内容std::string:

http://www.cplusplus.com/reference/string/string/