You must write std::string::find.
int main(){
string s1 = "hello! C wor";
string s2 = "world";
ssize_t pos;
if ( (pos = s1.find(s2, 0, 3)) != std::string::npos) {
std::cout << "found!" << '\n';
cout << pos << endl;
}
}
© 2024 OneMinuteCode. All rights reserved.