I am trying to parse data from a text file that is formatted in a predefined way, as follows:
"GROUP","SCPT" "DATA","CPT1","1","0.000","0.004","","-0.2","-0.5","","",""
I am using boost::tokenizer to do the parsing, as follows:
using Tokenizer = boost::tokenizer<boost::escaped_list_separator<char>>;
Tokenizer tokens{line}; // line is read from a file stream
for(auto data : tokens) {
// ... code follows
However, that gives me the tokens "GROUP" and "SCPT" instead of GROUP and SCPT (i.e. it includes the quotes in the token).
I have tried using my own separator:
boost::escaped_list_separator<char> els('\\', ',\"', '\"');
Tokenizer tokens{line, els};
but this doesn't work.
Can anyone help me please to convert the data above into
GROUP/SCPT
DATA/CPT1/1/0.000/0.004//-0.2/-0.5///
(where the / delinetaes the tokens) instead of
"GROUP"/"SCPT"
"DATA"/"CPT1"/"1"/"0.000"/"0.004"/""/"-0.2"/"-0.5"/""/""/""
Thanks in advance for any help you can give.
Andrew