Answers for "how to know the number of a certain substring in a string in c++"

C++
0

how to know the number of a certain substring in a string in c++

int nPos = str_to_search.find(str, 0); 
while (nPos != string::npos)
{
	count++;
	nPos = str_to_search.find(str, nPos + str.size());
}
Posted by: Guest on September-13-2021

Code answers related to "how to know the number of a certain substring in a string in c++"

Browse Popular Code Answers by Language