System.out.println removal/comment from multiple java source files

后端 未结 7 1823
失恋的感觉
失恋的感觉 2021-01-13 11:08

I want to remove/comment all the occurrences of System.out.println from my java code. This System.out.println may be inside if ,

相关标签:
7条回答
  • 2021-01-13 11:59

    I've used the jEdit text editor to accomplish tasks like this. There are probably other text editors that can do the same, the important feature is find and replace searching through directories/subdirectories.

    1. Open up a find and replace dialogue.
    2. Make sure the search folders and subdirectories options are checked. Again, this is the key to getting things handled across your entire project.
    3. Write "System.out.println" in the find field. Write a regular expression to handle the arguments.
    4. Write //System.out.println or perhaps more safely "/*System.out.println*/" in the replace field (or just leave it blank if that's preferable). Use the regular expression matches to replace the original arguments to the function.
    5. I suggest you replace the first few occurrences manually to make sure everything is going as expected. Once you're convinced it is, hit replace all and celebrate.

    I'm not a Java programmer, but this solution should work for any language. Hope that helps. Good luck!

    0 讨论(0)
提交回复
热议问题