当前位置:网站首页>STD:: String implements split
STD:: String implements split
2022-04-23 05:27:00 【Chip Witch A】
#include "stdafx.h"
#include <string>
#include <vector>
int split(std::string pszSrc, const char* flag, std::vector<std::string>& vecDat)
{
if (pszSrc.empty() || !flag)
return -1;
std::string strContent, strTemp;
strContent = pszSrc;
std::string::size_type nBeginPos = 0, nEndPos = 0;
while (true)
{
nEndPos = strContent.find(flag, nBeginPos);
if (nEndPos == std::string::npos)
{
strTemp = strContent.substr(nBeginPos, strContent.length());
if (!strTemp.empty())
{
vecDat.push_back(strTemp);
}
break;
}
strTemp = strContent.substr(nBeginPos, nEndPos - nBeginPos);
nBeginPos = nEndPos + strlen(flag);
vecDat.push_back(strTemp);
}
return vecDat.size();
}
Reference resources :https://blog.csdn.net/wu110112/article/details/88222137
版权声明
本文为[Chip Witch A]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220543517356.html
边栏推荐
- Double click The jar package cannot run the solution
- Use of uniapp native plug-ins
- 2021-10-08
- selenium预先加载cookie的必要性
- (十一)vscode代码格式化配置
- Study notes: unity customsrp-11-post processing --- bloom
- 如果我是pm之 演出电影vr购票展示
- MFC实现资源单独Dll实现
- Create a tabbar component under the components folder, which is public
- egg中的多进程模型--egg文档搬运工
猜你喜欢

跨域CORS的情缘~

Laravel implements the Holy Grail model with template inheritance

CPT 104_TTL 09

varnish入门

如果我是pm之 演出电影vr购票展示

Camera imaging + homography transformation + camera calibration + stereo correction

Domain driven model DDD (III) -- using saga to manage transactions

Create a tabbar component under the components folder, which is public

Blender programmed terrain production

Uncle wolf is looking for a translator -- Plato -- ongoing translation
随机推荐
Semi synchronous replication of MariaDB
Implementation of resnet-34 CNN with kears
Source code analysis of how to use jump table in redis
Branch and loop statements
弘玑Cyclone RPA为国金证券提供技术支撑,超200个业务场景实现流程自动化
selenium预先加载cookie的必要性
Vscode settings JSON configuration
FileReader API file operation
Redis的基本知识
Cross domain CORS relationship~
跨域CORS的情缘~
Quick app bottom navigation bar
(十一)vscode代码格式化配置
Use of uniapp native plug-ins
C#测试调用PaddleSharp模块识别图片文字
Intel SGX preliminary learning and understanding notes (continuously updated)
2021-10-08
Blender programmed terrain production
egg中的多进程模型--egg文档搬运工
Necessity of selenium preloading cookies