C++ (Qt)QString str; QVector <int> a;QVector <int> b;QVector <int> c; foreach (const QString& s, str.split (" ")) { const QStringList list = s.split ("/", QString::KeepEmptyParts); if (!list.isEmpty ()) { a.push_back (list [0].toInt ()); } if (list.size () > 1 && !list [1].isEmpty ()) { b.push_back (list [1].toInt ()); } if (list.size () > 2 && !list [2].isEmpty ()) { c.push_back (list [2].toInt ()); }}
C++ (Qt)QString codeStr;QStringList capturedList;if (codeStr.contains('/'){ QRegExp sep1Reg("(\\d*/\\d*)*"); int pos = 0; while ((pos = sep1Reg.indexIn(codeStr, pos)) != -1) { capturedList.append(sep1Reg.cap(pos)); pos += sep1Reg.matchedLength(); }}else if (codeStr.contains('//'){ QRegExp sep2Reg("(\\d*//\\d*)*"); int pos = 0; while ((pos = sep2Reg.indexIn(codeStr, pos)) != -1) { capturedList.append(sep1Reg.cap(pos)); pos += sep2Reg.matchedLength(); }}else capturedList = codeStr.split(' ', QString::SkipEmptyParts).removeFirst(); if (capturedList.count() != codeStr.split(' ', QString::SkipEmptyParts).count() - 1) qDebug() << "Error";
C++ (Qt)if (list.size() > 1... // вместо !list.size()
C++ (Qt)bool ParseFacet( // возвращает false если ошибка const char * iStr, // исходная строка, начинается с "f", варианты см. выше std::vector <int> oVec[3] // 3 выходных вектора)
C++ (Qt)std::vector <int> * oVec;