I have to write a program in which i have to remove from a string another string if it found.
for ex "I am going to school" and second string is "cho" i have to remove cho from first.
the output should be "I am going to sol"

need help

c++ has both a replace method and a find method, for strings, which will do the job:

string test2 = "I am going to school";
test2.replace(test2.find("cho"),3,"");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.