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

mysql - java.sql.SQLException Parameter index out of range (1 > number of parameters, which is 0) -

c - ALSA programming: how to stop immediately -