I think you should read about QByteArray::replace() (many variants) and QByteArray::remove() and save yourself a bunch of effort and a whole lot of potential errors.
QByteArray toStrip
("This contains an * asterisk, maybe more * than one");
qDebug() << toStrip.replace("*", "");
// Output: "This contains an asterisk, maybe more than one"
QByteArray toStrip("This contains an * asterisk, maybe more * than one");
qDebug() << toStrip.replace("*", "");
// Output: "This contains an asterisk, maybe more than one"
To copy to clipboard, switch view to plain text mode
Bookmarks