0
点赞
收藏
分享

微信扫一扫

笔试刷题技巧总结


string字符串处理

1.将一个string类型的对象s中按照分隔符ch进行分割,将子字符串放入到vector<string>中的模块

 

vector<string> Vec;
int StartIndex = 0;int EndIndex = 0;
while(EndIndex != -1){
EndIndex = Input.find(";",StartIndex);
Vec.push_back(Input.substr(StartIndex,EndIndex - StartIndex));
StartIndex = EndIndex + 1;
}

 

举报

相关推荐

0 条评论