Assuming you are using std::string then you can use the substr method:
Code:#include <string> int main () { std::string str="get the substring from this string"; std::string str2 = str.substr (8,9); // "substring" ...
I want to remove a sub string from a string in C++
How can i do this.
Give me the algo only or tell me the logic for this program.
Assuming you are using std::string then you can use the substr method:
Code:#include <string> int main () { std::string str="get the substring from this string"; std::string str2 = str.substr (8,9); // "substring" ...
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks