Answers for "how to check if a string is a substring of another c++ stl"

C++
7

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.
}
Posted by: Guest on December-23-2020

Code answers related to "how to check if a string is a substring of another c++ stl"

Browse Popular Code Answers by Language