QString question
-
wrote on 28 Aug 2011, 20:22 last edited by
Hi, how would I remove all carriage returns , tabs, line feeds ect from a QString. I just want all character and number data.
Thanks
-
wrote on 28 Aug 2011, 20:25 last edited by
One way would be to use QString::replace(), use a QRegExp to find the characters/character sequences you mention, and replace them with "".
-
wrote on 29 Aug 2011, 18:54 last edited by
[quote author="Andre" date="1314563158"]One way would be to use QString::replace(), use a QRegExp to find the characters/character sequences you mention, and replace them with "".[/quote]
"QString::remove()":http://doc.qt.nokia.com/4.7-snapshot/qstring.html#remove would be equivalent, too. You also might consider the possibility of using "QString::simplified()":http://doc.qt.nokia.com/4.7-snapshot/qstring.html#simplified to cull out a lot of extraneous white space first, if it would help in building your QRegExp.
-
Hi, how would I remove all carriage returns , tabs, line feeds ect from a QString. I just want all character and number data.
Thanks
wrote on 20 Oct 2016, 05:20 last edited byHi ,
U can use the RegExp and String.simplified() also.