Results 1 to 4 of 4

Thread: How to avoid unnecessary chars in QStringList item?

  1. #1
    Join Date
    Sep 2008
    Posts
    9
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default How to avoid unnecessary chars in QStringList item?

    Hi,

    I am trying to delete ? characters from the below data and want to store the resultant output in a QStringList item.

    QString receivedItem = "BOM ?
    DEL:1.0 ?
    VSP:UTF-8/ ?
    HYD/ThisisTest ?
    END:VBKM"

    Can anybody help me how can I do this?

    Thanks in advance.

    Regards,
    Chandra

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to avoid unnecessary chars in QStringList item?

    What's wrong with using QString::remove() (the one that takes a QChar)?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to avoid unnecessary chars in QStringList item?

    or maybe you want to use QString::split()? If you use it on your string like this:
    Qt Code:
    1. QStringList list = receivedItem.split("?");
    To copy to clipboard, switch view to plain text mode 
    then the list contains 5 items: "BOM ", "DEL:1.0 ", "VSP:UTF-8/ ", "HYD/ThisisTest ", "END:VBKM"
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to avoid unnecessary chars in QStringList item?

    hey are you chandra moli?

Similar Threads

  1. Replies: 2
    Last Post: 12th June 2009, 10:55
  2. position of an item in a QStringList
    By jaca in forum Newbie
    Replies: 4
    Last Post: 29th May 2008, 05:49

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.