Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ check if string contains substring

string str ("There are two needles in this haystack.");
string str2 ("needle");

if (str.find(str2) != string::npos) {
//.. found.
} 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #string #substring
ADD COMMENT
Topic
Name
9+3 =