//字符串分割函数
std::vector<std::string> split(std::string str,std::string pattern)
{
std::string::size_type pos;
std::vector<std::string> result;
str+=pattern;//扩展字符串以方便操作
int size=str.size(); for(int i=; i<size; i++)
{
pos=str.find(pattern,i);
if(pos<size)
{
std::string s=str.substr(i,pos-i);
result.push_back(s);
i=pos+pattern.size()-;
}
}
return result;
}
相关文章
- c++构造函数隐式转换--转换构造函数
- qt报错 his file requires compiler and library support for the ISO C++ standard.
- 《测试驱动的嵌入式C语言开发》——2.3节CppUTest:一个用C++实现的自动化单元测试框架...
- qq密码防盗:c++获取当前qq号,qq盗号木马源码分享!
- 学习笔记 c++ (简单的消息队列)
- Kettle1-js截取字符串
- Windows10 VS C++ xml解析(tinyxml2库)
- C++矩阵运算库armadillo配置笔记
- Android Studio 无法调试 C/C++ 程序
- 从格式化字符串泄露canary到栈溢出