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.
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 🎉 !
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.
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 //
\/\/.*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With