Is there any I could parse space and quotes to vector? like for example:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
void ParseFunc(string str, vector<string>& output)
{
//How can I do it?
}
int main()
{
string command = "hello world=\"i love coding\" abc=123 end";
vector<string> str;
ParseFunc(command, str);
for(int i = 0; i != str.size(); i++)
{
cout << str[i] << endl;
}
}
and i want the output be:
hello
world
=
i love coding
abc
=
123
Please help me!