简单的js文件去掉换行和注释

来源:互联网 发布:卢本伟的淘宝店叫什么 编辑:程序博客网 时间:2024/05/17 04:13
public static void main(String[] args) throws IOException {  InputStreamReader ir = new InputStreamReader(Test.class.getClassLoader().getResourceAsStream("riskBip.tools.js"));  BufferedReader br = new BufferedReader(ir);  String res = "";  while(true){   String temp = br.readLine();   if(temp != null){    String tempTrim = temp.trim();    int i = tempTrim.indexOf("//");    if( i != -1 ){     tempTrim = tempTrim.substring(0, i);    }    res += tempTrim;   }else{    break;   }  }  System.out.println(res); }
把结果写入到js文件的操作我就懒的写了大笑                                             
0 0
原创粉丝点击