string 截取字符串

截取substr

//string的操作
#include<iostream>
using namespace std;
int main()
{
    string a,b;
    a="abcde";
    b=a.substr(1);
//    b=a.substr(1,2);
    cout<<a<<endl;
    cout<<b<<endl;
} 
View Code

猜你喜欢

转载自www.cnblogs.com/helloworld2019/p/10396909.html