va代码中所有的注释

va代码中所有的注释

删除 java代码中所有的注释.java


public class CleanCommons {
private static Pattern pattern = Pattern.compile("/\\*.+?\\*/", Pattern.DOTALL); public static void main(String[] args) throws IOException {
Collection<File> java = FileUtils.listFiles(new File("E:\\dev\\riskManagement\\rm"), new String[]{"java"}, true);
for (File file : java) {
String content = FileUtils.readFileToString(file, "utf-8");
FileUtils.writeStringToFile(file, cleanCommons(content), "utf-8");
}
} public static String cleanCommons(String content) {
content.replaceAll("//.+\\r\\n", "");
return pattern.matcher(content).replaceAll(""); }
}
05-04 07:17