Hi,
I have the following code, which should find all occorences of '_' which is followed by a number, and replace it with a '.' (dot).
But nothing is being replced...
I guess my QRegExp is wrong, but from reading the docs, I don't understand why...
Thanks.
int main(int argc, char *argv[])
{
//Q_INIT_RESOURCE(application);
QFile ifile
("marquard.csv");
QFile ofile
("marqurd_new.cvs");
istream>>text;
text.replace(re,".");
ostream<<text;
ifile.close();
ofile.close();
return app.exec();
}
int main(int argc, char *argv[])
{
//Q_INIT_RESOURCE(application);
QApplication app(argc, argv);
QRegExp re("_(?=\d+)");
QFile ifile("marquard.csv");
QFile ofile("marqurd_new.cvs");
ifile.open(QIODevice::ReadOnly);
ofile.open(QIODevice::WriteOnly);
QTextStream istream(&ifile);
QTextStream ostream(&ofile);
QString text;
istream>>text;
text.replace(re,".");
ostream<<text;
ifile.close();
ofile.close();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks