Results 1 to 4 of 4

Thread: paticualr string

  1. #1
    Join Date
    Sep 2014
    Posts
    94
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default paticualr string

    QString str = "{“result”:0,“command” : “frontend_get_info”,“commandIdâ €:0,“bitErrorRate”:0,“noiseR atio”:28,“error”: “xxx”,“lockStatus”: “lock”}";

    i want to get only value 28 from string ....

    how can i get plz give some solution with code

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: paticualr string

    This looks like JSON so use appropriate API.

  3. #3
    Join Date
    Sep 2014
    Posts
    94
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: paticualr string

    yes it is json response

  4. #4
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: paticualr string

    Hi, you can use QString::split to split the string at the comma, the iterate over the resulting QStringList and check for the key you are looking for, e.g. “noiseRatio”.
    Although a real JSON API would probably be easier to use and more versatile.

    Ginsengelf

Similar Threads

  1. String Manipulation and string functions
    By Snaidy in forum Newbie
    Replies: 2
    Last Post: 26th August 2016, 11:49
  2. Replies: 3
    Last Post: 8th June 2011, 06:36
  3. std:string how to change into system:string?
    By yunpeng880 in forum Qt Programming
    Replies: 1
    Last Post: 14th April 2009, 08:51
  4. Int to String - manipulating string
    By mickey in forum General Programming
    Replies: 6
    Last Post: 5th November 2007, 20:11
  5. String value
    By Gayathri in forum Newbie
    Replies: 2
    Last Post: 21st November 2006, 05:44

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.