文件相关
1.字符串分割
vector<string> smallby_split(string str,string pattern){ string::size_type pos; vector<string> vec; str += pattern; //可匹配最后的字符 int size = str.size(); if(pattern == ""){ vec.push_back(str); return vec; } for(int i=0; i<size; ++i){ pos = str.find(pattern,i); if(pos<size){ vec.push_back(str.substr(i,pos-i)); i = pos + pattern.size(); i -= 1; //要执行++i } } return vec; }