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

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -