1

I have a QString containing Latitude/Longitude data in the following format:

27° 34' 35.67" 45° 37' 28.34"

I want to be able to strip/remove all the special characters (°, ', ") but I am not able to do so with the following code:

lat.remove(QRegExp(QString::fromUtf8("[\\°\'\"]")));

When I printout the result of lat, I get:

lat = "27\260 34 35.67"

So it looks like it was able to strip the ' and " characters but not the ° symbol.

Any idea how to make this work? I would like the final format to contain only spaces or lat = "27 34 35.67"

  • Where does the `\\` come from in the result? Are you sure this is correct? – Philipp Wendler Mar 17 '15 at 18:50
  • sorry I didn't specify but this is the printout from within the debugger. Playing with this a little more and I have to change it to the following for it to work properly (see update above). – Hien Nguyen Mar 17 '15 at 18:58
  • Please do not edit your question to include an answer if you found it, post it as an answer it (you can add an answer to your own questions on StackOverflow). – Philipp Wendler Mar 17 '15 at 19:04

1 Answers1

1

I was able to make it work with the following:

lat.remove(QRegExp(QString::fromUtf8("[\x00b0\'\"]")));