C++ find函数简单应用

find函数可在已知字符串中查找子串

#include
#include

using namespace std;

int main()
{
	string s1 = "Rey Dennis Steckler";
	string s2 = "Dennis";
	string s3 = "Ed Wood";

	int f;
	f = s1.find(s2);

	if(f < s1.length())
		cout<<"Found at index: "<


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