String tokenizer suggestion?
I'm about to implement a data file reader for CSV and will have lines like this:
"1","2","3"
...that I want to be turned into std::vector<std::string> containing "1", "2", and "3".
Easy. However, I have two caveats:
First, I want to see blanks: "1",,"2" needs to become "1", "", "2"
Second, I want to support escaping the delimiter: "1\,2","3" becomes "1,2", "3" . Similarly, "1\"2", "3" becomes "1\"2" (the characters 1, double-quote, 2), "3" .
I can roll my own or use a supplied version. I'd prefer the latter, but it also has to be compatible with the GPL.
Any suggestions?
"1","2","3"
...that I want to be turned into std::vector<std::string> containing "1", "2", and "3".
Easy. However, I have two caveats:
First, I want to see blanks: "1",,"2" needs to become "1", "", "2"
Second, I want to support escaping the delimiter: "1\,2","3" becomes "1,2", "3" . Similarly, "1\"2", "3" becomes "1\"2" (the characters 1, double-quote, 2), "3" .
I can roll my own or use a supplied version. I'd prefer the latter, but it also has to be compatible with the GPL.
Any suggestions?
