Erase a range of characters using an overloaded version of erase()
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
int main ()
{
string strSample ("Hello String!");
strSample.erase (strSample.begin (), strSample.end ());
if (strSample.length () == 0)
cout << "The string is empty" << endl;
return 0;
}
Related examples in the same category