C++ string简单的使用技巧

截取substr

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

 

posted @   Hello_World2020  阅读(184)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示