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

Jason Cipriani jason.cipriani at gmail.com
Wed Feb 6 00:37:59 CET 2013


On Tue, Feb 5, 2013 at 3:53 PM, Jason H <scorp1us at yahoo.com> wrote:

> is there a concern about percent encoded characters?
> %20, %7f, etc.
>
> I think QURL would handle that better.
>

Nope, won't have any of those.


*From:* d3fault <d3faultdotxbe at gmail.com>

> 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.



Thanks! I will just use split() (that's how I'm doing it now). I just
wanted to make sure there wasn't some kind of magic Qt property-holding
object that could parse strings in this format, still amateur with Qt and
trying not to reinvent wheels.

Thanks again guys,
Jason






>   ------------------------------
> *From:* d3fault <d3faultdotxbe at gmail.com>
> *To:* Qt Interest <interest at qt-project.org>
> *Sent:* Monday, February 4, 2013 10:07 PM
> *Subject:* Re: [Interest] Parsing key/value pairs from a string.
>
> 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
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130205/3222cd5e/attachment.html>


More information about the Interest mailing list