c++ - how to tell if a string is contained in another string -


this question has answer here:

c++ code. example: x: "this #my first program"; y: "#my";

bool function(string x, string y) { //return true if y contained in x  return ???;  } 

you can use std::string::find()

bool function(string x, string y) {     return (x.find(y) != std::string::npos); } 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -