string substr(int pos = 0, int n = npos) const;//返回由pos开始的n个字符组成的字符串
#include <iostream>
using namespace std;
#include <string>
void test01()
{
string str = "hello";
string s = str.substr(1, 3);
cout << s << endl;
}
//实用操作:从邮件地址中获取 用户信息
void test02()
{
string email = "12345@qq.com";
int pos = email.find("@");
string usrname = email.substr(0, pos);
cout << usrname << endl;
}
int main()
{
test01();
test02();
return 0;
}