Reputation: 11727
Hi I have a string variable with large content. I have to remove unwanted line from the string content and keep remaining content as it is. Following is output that we get after printing the string:
string varString;
cout<<"String content :"<<endl<<varString<<endl;
Output is :
String content :
/abc/def/ghi/klm/run.so
call::myFuncton(int const&)
call::MY::Method(char const&)
.
.
.
call::MY::newFunction(char *&)
Now i have to remove "call::myFuncton(int const&)" line from above string variable and keep other data as it is. can any one tell tell me how i can remove that line from sting variable? Thanks in advance
Upvotes: 0
Views: 327
Reputation: 1837
You can use the function varString.find() to find the position where the string occurs, and then use varString.erase() to erase the text.
Upvotes: 2
Reputation: 1790
You can use Regex to replace the required string call::myFuncton(int const&) using Regex. You can find more information about using Regex in C++ from this link C++: what regex library should I use?
Upvotes: 0