removing a substring from a std::string
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
can anyone tell me how do I remove a substring from a string, like i have "abc.xml" and i want to remove ".xml" from it and in turn just get abc. How do i do it?
-
can anyone tell me how do I remove a substring from a string, like i have "abc.xml" and i want to remove ".xml" from it and in turn just get abc. How do i do it?
Type something like this. Again I haven't tested this. --------------------------------------- string::size_type LastDotPos = YourString.find_last_of('.'); if ( LastDotPos != -1 ) { string BeforeDot = YourString.substr(0, LastDotPos); } Steve