Results 1 to 2 of 2

Thread: [solved]QString.replace()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default [solved]QString.replace()

    Hi
    I have a little question.
    I have a String in my Program and this String should be immutable. But some methods have to replace something in the String and return it.
    The problem is, that QString.replace returns a reference and so the immutable String is also changed.

    Why replace returns a reference to the String instead of a proper String. So I have to copy the immutable String to another Variable and this is indricate.
    Last edited by Qiieha; 16th September 2011 at 09:25.

Similar Threads

  1. Replies: 2
    Last Post: 11th August 2011, 15:42
  2. QString - find and replace text
    By graciano in forum Newbie
    Replies: 3
    Last Post: 24th January 2009, 20:35
  3. QString::replace() with QRegExp capture modification
    By Lykurg in forum Qt Programming
    Replies: 1
    Last Post: 4th March 2008, 09:50
  4. Replies: 4
    Last Post: 31st January 2008, 20:44
  5. Replace text
    By Hz in forum Qt Programming
    Replies: 2
    Last Post: 22nd March 2006, 08:16

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.