Results 1 to 2 of 2

Thread: Comments Cleaner

  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Comments Cleaner

    I want clean any comments in my source code. I tried like this. But I think not work properly

    Qt Code:
    1. QRegExp ex("//[^\n]*"); //single line comment
    2.  
    3. QFile f("/home/wirasto/coba.php");
    4. if (f.open(QIODevice::ReadOnly|QIODevice::Text)) {
    5. QTextStream in(&f);
    6. while (!in.atEnd()) {
    7. QString str=in.readLine();
    8. qDebug() << str.replace(ex, "");
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

    And I think for multiline comments will be more difficult

    I already found this thread.

  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: Comments Cleaner

    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.


Similar Threads

  1. How to comment CSS code with comments inside ?
    By tonnot in forum General Programming
    Replies: 4
    Last Post: 16th October 2011, 15:02
  2. Qt 5 comments??
    By nish in forum General Discussion
    Replies: 11
    Last Post: 11th May 2011, 18:44
  3. Comments in ui files
    By robertf in forum Qt Programming
    Replies: 5
    Last Post: 8th July 2008, 20:08
  4. BSCommander - need a comments
    By piotrpsz in forum Qt-based Software
    Replies: 0
    Last Post: 11th February 2006, 09:40
  5. Code comments
    By zlatko in forum General Programming
    Replies: 9
    Last Post: 9th February 2006, 08:27

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.