PDA

View Full Version : removing carriage return from QString



gren15
28th June 2009, 04:52
I have a QString (which is a URL) from which i want to remove invalid characters like carriage return (\n), tab (\t), \r etc

I tried:


urlString.remove(QRegExp("[\n\t\r]"));


But this doesn't work.

Any help will be appreciated.
Thanks.

nanortemis
28th June 2009, 08:56
Hi,

Try this



urlString.remove(QRegExp("[\\n\\t\\r]"));

Lykurg
28th June 2009, 14:56
Or simply use QString::simplified()!

gren15
28th June 2009, 23:07
Thanks for the replies! :)