Qt Cutstring
QString data = "SEQ=1111&c=B&b=22&JIG=33&tmt=4&msp=5&e";
parseThangs(data);
void MainWindow::parseThangs(QString str)
{
int startIndex;
int endIndex;
QString myString,SEQ,cFP,bFP, JIG,tmt,msp;
myString = str;
startIndex = myString.indexOf("S");
endIndex = myString.indexOf("c");
SEQ = myString.mid(startIndex+4,endIndex-5);
qDebug() << "SEQ = "<< SEQ;
myString = str;
startIndex = myString.indexOf("c");
endIndex = myString.indexOf("b");
cFP = myString.mid(startIndex+2,endIndex-12);
qDebug() << "cFP = "<< cFP ;
myString = str;
startIndex = myString.indexOf("b");
endIndex = myString.indexOf("J");
bFP = myString.mid(startIndex+2,endIndex-16);
qDebug() << "bFP = "<< bFP ;
myString = str;
startIndex = myString.indexOf("J");
endIndex = myString.indexOf("t");
JIG = myString.mid(startIndex+4,endIndex-23);
qDebug() << "JIG = "<< JIG ;
myString = str;
startIndex = myString.indexOf("t");
endIndex = myString.indexOf("m");
tmt = myString.mid(startIndex+4,endIndex-25);
qDebug() << "tmt = "<< tmt ;
myString = str;
startIndex = myString.indexOf("m");
endIndex = myString.indexOf("e");
msp = myString.mid(startIndex+9,endIndex-36);
qDebug() << "msp = "<< msp ;
}
0 ความคิดเห็น:
แสดงความคิดเห็น
สมัครสมาชิก ส่งความคิดเห็น [Atom]
<< หน้าแรก