2014年3月5日
摘要: C++标准库里面没有字符分割函数split ,这可太不方便了,我已经遇到>3次如何对字符串快速分割这个问题了。列几个常用方法以备不时之需。方法一: 利用STL自己实现split 函数(常用,简单,直观)原型:vector split(const string &s, const string &seperator);输入一个字符串,一个分隔符字符串(可包含多个分隔符),返回一个字符串向量。这是我最喜欢的方法,因为它最直观,在平常也最常用。实现及测试代码如下#include #include #include using namespace std;vector split 阅读全文
posted @ 2014-03-05 22:51 dfcao 阅读(190806) 评论(8) 推荐(9) 编辑