View Full Version : QRegExp help
bandito
1st May 2016, 17:07
I would like to remove all lines from a QString that have text and keep the ones that are numbers.
Prior to running a regexp my QString output be as so:
hello
1
world
2
if I ran something like
QString.remove(QRegExp("(^[a-z]*\\n$)")) my QString output would be:
1
2
yeye_olive
1st May 2016, 21:17
So? Have you tried the solution you propose? Did you get the expected result?
bandito
2nd May 2016, 00:15
So? Have you tried the solution you propose? Did you get the expected result?
No. I ended up just convert it to a QStringList and doing it line by line. The only reason I wanted to do it with a regexp was to save some lines of code.
anda_skoa
2nd May 2016, 08:35
Well, that would have only saved one line of code compared to using QString::split() and QStringList::filter() :)
Cheers,
_
d_stranz
2nd May 2016, 18:35
Obviously not being paid per line of code.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.