标签:back find int tor har fine template stream std
//vov
#ifndef VSTRING_HPP
#define VSTRING_HPP
#include <string>
#include <sstream>
#include <vector>
template<class T>
static T vStringToNum(const std::string &str) {
std::stringstream ss;
ss<<str;
T num;
ss>>num;
return num;
}
template<class T>
static std::string vNumToString(T num) {
std::stringstream ss;
ss<<num;
return ss.str();
}
static bool vCharAtString(const char ch,const std::string &str) {
return (str.find(ch)!=std::string::npos)?true:false;
}
static std::vector<std::string> vStringSplit(const std::string &str,const std::string &label) {
std::vector<std::string> vstr;
std::string strtmp;
for(int i=0;i<str.size();i++) {
if(!vCharAtString(str[i],label)) {
strtmp+=str[i];
}
if(vCharAtString(str[i],label)||i==str.size()-1) {
vstr.push_back(strtmp);
strtmp.clear();
}
}
return move(vstr);
}
#endif
标签:back find int tor har fine template stream std
原文地址:https://www.cnblogs.com/smallredness/p/10758545.html