首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

c++字符串有关问题

2012-02-22 
c++字符串问题怎样取出下面引号中的字符串a/ daaaagfdgfdfdfdf asa /[解决办法]代码有,估计不是你

c++字符串问题
怎样取出下面引号中的字符串
a/ < "daaaa   gfdg   fdf   dfdf "> "asa "/

[解决办法]
代码有,估计不是你要的。
#include <iostream>
#include <boost/regex.hpp>
#include <string>
#include <list>

using namespace std;
int main()
{
string s= "a/ <\ "daaaa gfdg fdf dfdf\ "> \ "asa\ "/ ";
list <string> l;
boost::regex e( "\ "([^\ "]*)\ " ");
boost::regex_split(std::back_inserter(l), s, e);
while(l.size())
{
s = *(l.begin());
l.pop_front();
cout < < s < < endl;
}

system( "pause ");
return 0;
}

热点排行