C++ (Qt)bool ReplaceBetween( QString & str, // string to modify (" ***56***") const QString & mark, // bounded substring ("***") int delta ) // value increment{// start index int beg = str.indexOf(mark, 0); if (beg < 0) return false; // no start mark *** beg += mark.size(); // end index int end = str.indexOf(mark, beg); if (end < 0) return false; // no end mark *** // get current value QString sub = str.mid(beg, end - beg); bool ok; int val = sub.toInt(&ok); if (!ok) return false; // no int between marks // replace with new value str.replace(beg, end - beg, QString::number(val + delta)); return true;}