linux - How to remove unwanted content from string in c++? -
hi have string variable large content. have remove unwanted line string content , keep remaining content is. following output after printing string:
string varstring; cout<<"string content :"<<endl<<varstring<<endl; output : string content : /abc/def/ghi/klm/run.so call::myfuncton(int const&) call::my::method(char const&) . . . call::my::newfunction(char *&)
now have remove "call::myfuncton(int const&)" line above string variable , keep other data is. can 1 tell tell me how can remove line sting variable? in advance
you can use function varstring.find() find position string occurs, , use varstring.erase() erase text.
Comments
Post a Comment