C++ - Remove or skip quote char in reading a file line by tokenizer

I have a csv file that has records like:

837478739*"EP"1"3FB2B464BD5003B55CA6065E8E040A2A"*"F"*21*15*"NH"*"N"0*-1*"-1"*0*0**-1*223944*-1*"23"1"-1""-1""78909""-1""-1""-1""-1""-1""-1""-1""-1""-1""-1""-1""-1""-1""74425""26""-1"*"-1"*1*1*69*23.58*0*0*0*0*"MC"

The file has lots of records, so I need a fast method to breakdown the line and push_back each of those parts into a vector. The main reason I choose tokenizer is that I heard a lot about its performance. I have a function:

void break(){
   //using namespace boost;
   string s = "This is a , test '' file";
   boost::tokenizer<> tok(s);
   vector<string> line;
   for(boost::tokenizer<>::iterator beg=tok.begin();beg!=tok.end();++beg){
       line.push_back(*beg);
   }
   cout << line[3] << "  and  " << line[5] << endl;
}

By that I can get each part of the sentence and ignore everything that is not a letter. Does the tokenizer have the ability to read the record that I have and parse them by "*" delimiter and remove the quotes from the string? There won't be any kind of special character between quotes, I just need to remove the quote marks. I tried to read the tokenizer document, but nothing came out.

Answers


You need to assign another TokenizerFunc to your Tokenizer to parse the string differently, the default parses on space and punctuation

http://www.boost.org/doc/libs/1_37_0/libs/tokenizer/tokenizerfunction.htm


You can use regex_replace.

"break" is keyword. You shouldn't use it for function name.


Need Your Help

PostgreSQL query failure

sql postgresql postgresql-9.2 postgresql-9.3

I have a unique problem with PostgreSQL. After inserting data into a database I try and retrieve everything greater than a specific string. However, it does not return any data. So, I tried this on

array traversal algorithm to load the array with Rationals

java arrays object traversal

I have a java class already made up of methods and am in the process of creating a driver java class and just need some help figuring out how to load my traversal array with rationals. I have the