#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <sstream>
using namespace std;
template<typename T>
void printVector(T& arg)
{
typename T::iterator it = arg.begin();
while(it != arg.end())
{
cout<<*it<<" ";
it++;
}
}
int stringToInt(string& s)
{
int ret;
stringstream tmp;
tmp<<s;
tmp>>ret;
return ret;
}
vector<string> cutString(string& arg,const char& delim)
{
vector<string> ret;
string::size_type begin = 0;
for(string::size_type i = 0; i < arg.size(); i++)
{
if(arg[i] == delim)
{
if(i > 0 && arg[i - 1] != delim)
{
ret.push_back(string(arg,begin, i - begin));
}
begin = i + 1;
}
}
if(begin != arg.size())
{
ret.push_back(string(arg,begin,arg.size() - begin));
}
return ret;
}
MyLib
最新推荐文章于 2022-11-29 10:40:43 发布