键盘的咏叹调

常用链接

统计

最新评论

std::string的split函数

void split(std::string& s, std::string& delim,std::vector< std::string >* ret)
{
 size_t last = 0;
 size_t index=s.find_first_of(delim,last);
 while (index!=std::string::npos)
 {
  ret->push_back(s.substr(last,index-last));
  last=index+1;
  index=s.find_first_of(delim,last);
 }
 if (index-last>0)
 {
  ret->push_back(s.substr(last,index-last));
 }
}

posted on 2008-11-05 16:55 键盘的咏叹调 阅读(9394) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理