Results 1 to 3 of 3

Thread: qstring replace backslash by forward-slashes

  1. #1
    Join Date
    Jun 2010
    Posts
    100
    Thanks
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qstring replace backslash by forward-slashes

    Hi all!

    I am trying to replace backslashes '\' by forward-slashes as a lineEdit is being changed.
    On the _textEdit event I have this code:

    ui.TempClientForlder->text().replace(QString("\\"),QString("/"));

    I tried many other ways but I can't figure it out.

    Any help? thanks!

  2. #2
    Join Date
    Dec 2009
    Posts
    128
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Platforms
    Unix/X11 Windows

    Default Re: qstring replace backslash by forward-slashes

    Qt Code:
    1. QLineEdit::text()
    To copy to clipboard, switch view to plain text mode 
    returns a copy of the string. You will have to modify that copy, and put this copy back to the QLineEdit.

  3. The following user says thank you to totem for this useful post:

    ruben.rodrigues (8th November 2011)

  4. #3
    Join Date
    Jun 2010
    Posts
    2

    Default Re: qstring replace backslash by forward-slashes

    .replace('\\','/')

Similar Threads

  1. [solved]QString.replace()
    By Qiieha in forum Qt Programming
    Replies: 1
    Last Post: 16th September 2011, 10:15
  2. Replies: 2
    Last Post: 6th April 2011, 08:43
  3. make install problem with (back)slashes
    By brazso in forum Qt Programming
    Replies: 1
    Last Post: 1st July 2010, 11:15
  4. QString - find and replace text
    By graciano in forum Newbie
    Replies: 3
    Last Post: 24th January 2009, 21:35
  5. QString::replace() with QRegExp capture modification
    By Lykurg in forum Qt Programming
    Replies: 1
    Last Post: 4th March 2008, 10:50

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.