You can split a QString using QString::split and use QRegExp for capture part of string matching a pattern

Qt Code:
  1. // Split in lines
  2. QStringList lines = aaa.split('\n');
  3. QRegExp re("([+-]\\d*)([+-]\\d*)");
  4.  
  5. Q_FOREACH (QString line, lines) {
  6. if (re.exactMatch(line)) {
  7. a1 = rx.cap (1);
  8. a2 = rx.cap (2);
  9. // do something with a1 and a2
  10. }
  11. else {
  12. bb = line;
  13. // do something with bb
  14. }
  15. }
To copy to clipboard, switch view to plain text mode