Possible Duplicates:
How to split a string in C++? Splitting a C++ std::string using tokens, e.g. “;”
think I have this string :
string a = "hello,usa,one,good,bad";
I want to split开发者_如何学Goting this string with ,
so I need a array of string like here :
string *a ; a = { hello , usa , one , good , bad }
what shoudl I do ?
This simple AXE parser will do it:
std::vector<std::string> strings;
auto split = *(*(axe::r_any() - ',') >> e_push_back(strings));
split(a.begin(), a.end());
If you really don't want to code this on your own you can do a web search for "c++ tokenize string" and take, for example, a look here: CPPHOWTO
精彩评论