Results 1 to 2 of 2

Thread: Qstring question!!

  1. #1

    Default Qstring question!!

    Say i have a Qstring of the following

    QString str1 = "HelloWorldThere";

    How would i go about extracting the characters from index 2 all the way to index 7 within the string so i can effectively retrieve this sing.

    Qstring extractedString = "lloWor";

    Pretty much i just want to extract a string from within a string when i have a starting index and an ending index. Any help is greatly appreciated

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Qstring question!!

    See QString class reference and mid() function.

    Qstring extractedString = str1.mid(2, 6);

Similar Threads

  1. Replies: 2
    Last Post: 11th August 2011, 15:42
  2. Replies: 6
    Last Post: 7th January 2011, 08:31
  3. QString::toStdString in PyQt Question
    By di_zou in forum Newbie
    Replies: 1
    Last Post: 2nd November 2009, 20:09
  4. QString Question
    By fortyhideout12 in forum Qt Programming
    Replies: 1
    Last Post: 17th August 2009, 19:14
  5. Quick QString question: Using " characters in QStrings
    By JPNaude in forum Qt Programming
    Replies: 2
    Last Post: 6th March 2009, 07:30

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.