patcito
29th May 2006, 17:35
I have an process that outputs lines like that:
0,0,1 some blah
0,1,0 some blah
1,0,1 some blah
2,0,1 some blah
I want to grab the first numeric part, this is how I do it:
QString result = cdscanbus.readAllStandardOutput();
qDebug()<< result;
QRegExp rx("[0-9],[0-9],[0-9]");
int pos = rx.indexIn(result);
if(pos > -1){
QString value = rx.cap(0);
qDebug()<< value;
}
the problem is that qDebug only returns the first 0,0,0 expression.
any idea how to make it return all occurence of [0-9],[0-9],[0-9] ?
thanx in advance
Pat
0,0,1 some blah
0,1,0 some blah
1,0,1 some blah
2,0,1 some blah
I want to grab the first numeric part, this is how I do it:
QString result = cdscanbus.readAllStandardOutput();
qDebug()<< result;
QRegExp rx("[0-9],[0-9],[0-9]");
int pos = rx.indexIn(result);
if(pos > -1){
QString value = rx.cap(0);
qDebug()<< value;
}
the problem is that qDebug only returns the first 0,0,0 expression.
any idea how to make it return all occurence of [0-9],[0-9],[0-9] ?
thanx in advance
Pat