
Originally Posted by
ChrisW67
A QStringList might be a good alternative to a fixed length array of strings.
If you want the captured string(s) then just use
QRegExp to capture the matches. There is a useful example in the docs.
Realy nice!!! this example is exactly that i want!
QString str
= "Offsets: 12 14 99 231 7";
int pos = 0;
while ((pos = rx.indexIn(str, pos)) != -1) {
list << rx.cap(1);
pos += rx.matchedLength();
}
// list: ["12", "14", "99", "231", "7"]
QRegExp rx("(\\d+)");
QString str = "Offsets: 12 14 99 231 7";
QStringList list;
int pos = 0;
while ((pos = rx.indexIn(str, pos)) != -1) {
list << rx.cap(1);
pos += rx.matchedLength();
}
// list: ["12", "14", "99", "231", "7"]
To copy to clipboard, switch view to plain text mode
so many thanks ChrisW67!!!
Bookmarks