c++string类寻找子串

c++中string类中的find函数用于寻找字符串中是否包含子串,如果包含,那么函数返回第一个找到的子串的位置,如果不包含,返回-1.
用法例子:

#include
#include

using namespace std;

int main()
{
	string a="testcodecodecode";
	string b="code";
	string c="lee";
	int a_b=a.find(b);
	int a_c=a.find(c);
	cout<

你可能感兴趣的:(C++)