摘要: 1 vector split(const string& src, const string& sep) { 2 vector tokens; 3 int lastPos = 0, // 上次找到的sep的位置 4 index, 5 sepLen = sep.length(); 6 while ( -1 != (index = src.find(sep, lastPos) )) { 7 // substr(起始位置,字符串长度) 8 tokens.push_back(src.substr(lastP... 阅读全文
posted @ 2013-09-11 00:35 StrikeW 阅读(190) 评论(0) 推荐(0) 编辑