64,649
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
using namespace std;
int main () {
string str = " qwe rt ";
cout << str << endl;
cout <<str.substr(str.find_first_not_of(' '),str.size()) << endl;
}
int main ( int argc, char *argv[] )
{
string s1=" this is a test ";
string s2;
s2=s1.substr(s1.find_first_not_of(' '),s1.find_last_not_of(' '));
cout << s2 <<endl;
system("pause");
return 0;
}
string str = " qwe rt ";
str = str.substr(1, str.size()- 1);