I have a QString in a format similar to QString word = "123,12,1,"This is, a test";
(Extracted from a CSV file). I would like to split it up at each comma, excluding any commas in the string in the last cell. The list would be similar to {"123", "12", "1", "\"This is, a test\""}
.
The format is a number that has a maximum of 3 digits, then a number with a maximum of 2 digits, then a number with a maximum of 1 digit, followed by a string that can include commas. There should always be 4 QStrings in the list. Here is what I'm trying
QString word = "123,12,1,\"This is, a test\"";
QStringList list = word.split( QRegExp( "(\\d+)," ) );
I got the code for this from here. This code only saves the 4th QString in the list, the first 3 are blank. Could someone help me out?