Using QRegExp:
Qt Code:
QStringList fields; if(rx.exactMatch(str)) fields = rx.capturedTexts();To copy to clipboard, switch view to plain text mode
Using QRegExp:
Qt Code:
QStringList fields; if(rx.exactMatch(str)) fields = rx.capturedTexts();To copy to clipboard, switch view to plain text mode
baray98 (15th April 2008)
What about QByteArray? While reading file you can fill the instance of it ...
Qt 5.3 Opensource & Creator 3.1.2
QRegExp is good ,i am not too familiar with it (need some work on my part ) . If you guys can lead me the way on how to breakinto pairs using QRegExp I will highly appreciate itdd is a data field that represents one byte of data.
reading the tricks of QRegExp,
baray98
What do you want to break here? If you have to characters in a string that represents a hexadecimal number, use QString::toInt() and you're done.
I am trying to break the data line into bytes
from the code belowQt Code:
fields.at(3) // data of the hex lineTo copy to clipboard, switch view to plain text mode
Qt Code:
QRegExp rx(":([0-9A-F]{2})([0-9A-F]{4})([0-9A-F]{2})([0-9A-F]*)([0-9A-F]{2})");QString str = "...";QStringList fields;if(rx.exactMatch(str)) fields = rx.capturedTexts();To copy to clipboard, switch view to plain text mode
baray98
Qt Code:
QStringList fields; if(rx.exactMatch(str)) fields = rx.capturedTexts();To copy to clipboard, switch view to plain text mode
sorry i mess up my cut and paste in the prior reply
baray98
Qt Code:
for(int i=0;i<str.size();i+=2) qDebug() << str.mid(i,2).toInt(0, 16);To copy to clipboard, switch view to plain text mode
baray98 (15th April 2008)
Bookmarks