C++子串substr的用法

头文件#include<string>

string s="0123456789"; 
string a=s.substr(1,5);
string b=s.substr(1);

上面代码中a="12345";   b="123456789";  第二个参数缺省值为串末尾。

猜你喜欢

转载自blog.csdn.net/buptlihang/article/details/82111927