Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to delete all comments in my code, in Android Studio? [duplicate]

I've been working on a project in the Android Studio, and it has a lot of comments in it. Is it possible to delete all the comments (both single line // and multi-line /*) in the code? Preferably, without dealing with regular expressions.

like image 271
Ege Kuzubasioglu Avatar asked Sep 04 '16 15:09

Ege Kuzubasioglu


People also ask

How do I delete all comments or code?

Once installed, remove comments in your code by opening the command palette ( Ctrl + Shift + P ), entering "Remove all comments" and pressing enter. Voilà, all the comments are gone 🎉 !

How do you delete comments in Java?

1) Open the java file in which comments are to be removed. 2) Press Ctrl+F if you are using windows, Cmd+F in Mac OS. 3) Select Regular Expressions in the Find Menu. 5) This action will remove all the comments -> Single Line as well as multiple line comments from the java file.


1 Answers

If you do not want comments in the code that you export, IntelliJ shouldn't export your comments. However, if you want to actually delete comments in a whole project, you can delete the /* x */ comments by using REGEX. For the // comments, you may also be able to use REGEX, but watch out not to delete your whole code while doing so.

For /* x */

\/\*([\s\S]*?\*\/)

For //

\/\/.*
like image 187
Sneling Avatar answered Sep 17 '22 12:09

Sneling