截短STL string
程序清单16.5
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
string s("Hello world");
// 1 from a to b
s.erase( 5, 10);
cout << s << endl;
//2 删除指向 s中某一字符的迭代器
string::iterator i = find( s.begin(), s.end(), 'H');//or auto i = find( s.begin(), s.end(), 'H');
if( i != s.end())
s.erase(i);
cout << s << endl;
//3 删除两个迭代器之间的字符
s.erase( s.begin(), s.end());
if(s.length() == 0)
cout << "s is empty" << endl;
}