[Interest] Parsing key/value pairs from a string.

d3fault d3faultdotxbe at gmail.com
Tue Feb 5 04:07:30 CET 2013


While what you're asking is easily accomplishing using
QString::split() [0] , you could convince QUrl [1] (or QUrlQuery [2]
if using Qt 5) to do it for you if you make the string a valid URL
first: "http://blah.com/?your=query&goes=here" and then ignore the
hostname/protocol functionality of QUrl. Just call QUrl::queryItems()
[3] to get your list. There could be negative implications in doing it
this way, so using QString yourself/manually might be safer.


d3fault

[0] - http://stackoverflow.com/questions/8582138/how-can-i-split-a-string-according-to-delimiters-in-qt
[1] - http://qt-project.org/doc/qt-4.8/qurl.html#setQueryDelimiters
[2] - http://qt-project.org/doc/qt-5.0/qtcore/qurlquery.html#non-standard-delimiters
[3] - http://qt-project.org/doc/qt-4.8/qurl.html#queryItems



More information about the Interest mailing list