Results 1 to 2 of 2

Thread: Part of QString

  1. #1

    Default Part of QString

    Hi

    I have the following QString:
    QString mystring
    "QT TEST TR.=123456 PORT 23"

    I need to copy only 123456 value to another QString.
    123456 is variable value.

    I tried to use mystring.section ("TR.=",1) but then is copied "123456 PORT 23"

    I do not know how to limit copy to " ".


    Regards
    Artur

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Part of QString

    You could use section() again on the result of the first section() call or use indexOf() twice, once to find the end of the prefix and once to find the end of the value and then use mid().

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 23rd August 2011, 13:23
  2. Replies: 2
    Last Post: 11th August 2011, 16:42
  3. Part of a QByteArray() to QString()
    By elcuco in forum Qt Programming
    Replies: 1
    Last Post: 4th November 2010, 21:09
  4. Replies: 4
    Last Post: 31st January 2008, 21:44
  5. how to copy part of QString to anothe QString
    By nass in forum Qt Programming
    Replies: 1
    Last Post: 26th March 2007, 20:05

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.