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

Jason Cipriani jason.cipriani at gmail.com
Mon Feb 4 21:53:42 CET 2013


I have a QString, properties, formatted something like:

  keyvalue = key <delimiter1> value
  properties = keyvalue *( <delimiter2> keyvalue )

E.g.: "color:red;material:wood;name:joe" or
"color=red&material=wood&name=joe" where <delimiter1> and <delimiter2> are
arbitrary but known ahead of time.

I'm loading the key/value pairs into a QMap<QString,QString>.

Easy enough to parse, my only question is: Does Qt already have something
built-in to parse key/value pairs with arbitrary delimiters into some data
structure? (Doesn't necessarily have to be a QMap<QString,QString>)

Just wondering if there's a one-liner to do it in the Qt API somewhere.

Thanks!
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130204/42f71541/attachment.html>


More information about the Interest mailing list