0

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

2
Contributors
1
Reply
12
Views
4 Years
Discussion Span
Last Post by tinstaafl
0

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,"");

Edited by tinstaafl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.