Is there a way to delete all comments in a file using Notepad++?

后端 未结 9 2086
清歌不尽
清歌不尽 2020-12-13 04:40

Notepad++ obviously recognizes all comments as such. Is there a way to simply delete all?

Edit: Stat-R\'s bookmark method has helped greatly, not on

9条回答
  •  没有蜡笔的小新
    2020-12-13 05:26

    Anton Largiader's answer was the most reliable one, including complex inline comments.

    However, it will leave many empty lines, including ones with empty characters (space, tabs...) so I would just add another step to make it almost perfect:

    After running the macro, just do:

    Edit > Line Operations > Remove Empty Lines

    OR

    Edit > Line Operations > Remove Empty Lines (Containing Blank Characters)

    1st option is good if you wish to remove only really empty lines 2nd options will remove every empty line even containing space etc. so there will be no more actual spacing left between code blocks. 1st option might be the safest with some manual cleanup afterwards.

提交回复
热议问题