#include<iostream>
#include<string>
using namespace std;
int main(){
string s="helloworld";
string a=s.substr(0,4); //substr(startPosition,lenth)
cout << a << endl;//输出hell
}
string之取子串
最新推荐文章于 2024-02-26 20:06:41 发布
#include<iostream>
#include<string>
using namespace std;
int main(){
string s="helloworld";
string a=s.substr(0,4); //substr(startPosition,lenth)
cout << a << endl;//输出hell
}