stealth86
25th July 2007, 22:42
I'm using QRegExp and I want to parse resolution strings for the width and height.
IE "640x480" should be parsed into two strings "640" and "480".
I thought I could do this with capturedTexts(), but it works differently than I expected. Anyways, there must be an easy way to do this and I'm just not seeing it.
This is what I wrote, which after reading the documentation will not of course do what I was hoping.
QRegExp RegExp( "\\d+" );
QStringList StringList;
RegExp.indexIn( strResolution );
StringList = RegExp.capturedTexts();
IE "640x480" should be parsed into two strings "640" and "480".
I thought I could do this with capturedTexts(), but it works differently than I expected. Anyways, there must be an easy way to do this and I'm just not seeing it.
This is what I wrote, which after reading the documentation will not of course do what I was hoping.
QRegExp RegExp( "\\d+" );
QStringList StringList;
RegExp.indexIn( strResolution );
StringList = RegExp.capturedTexts();