Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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());
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: constructor in cpp 
Cpp :: show stack c++ 
Cpp :: c++ saying hello world 
Cpp :: inserting element in vector in C++ 
Cpp :: print stack without pop c++ 
Cpp :: c ++ splitlines 
Cpp :: cpp define 
Cpp :: print hello world c++ 
Cpp :: c++ range based for loop 
Cpp :: factorial of large number 
Cpp :: vector in c++ 
Cpp :: map count function c++ 
Cpp :: how to create a c++ templeate 
Cpp :: c++ print 
Cpp :: lower bound and upper bound in c++ 
Cpp :: comparator priority queue c++ 
Cpp :: cyclic array rotation in cpp 
Cpp :: Translation codeforces in c++ 
Cpp :: onoverlapbegin ue4 c++ 
Cpp :: makefile for single cpp file 
Cpp :: string in c++ 
Cpp :: store array in vector 
Cpp :: how to make randomizer c++ 
Cpp :: move assignment operator c++ 
Cpp :: swap alternate elements in an array c++ problem 
Cpp :: c++ preprocessor commands 
Cpp :: how to make a pointer point to a the last value in an array 
Cpp :: fractional knapsack problem 
Cpp :: even and odd numbers 1 to 100 
Cpp :: vector of vectors c++ 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =