以前使用StringBuilder时都是每次new一个,因为找不到clear这样的方法,上网搜了一下,发现可以用setLength(0);或者delete(0,sb.length());
参考:http://stackoverflow.com/questions/242438/java-performance-of-stringbuilder-in-a-loop
以前使用StringBuilder时都是每次new一个,因为找不到clear这样的方法,上网搜了一下,发现可以用setLength(0);或者delete(0,sb.length());
参考:http://stackoverflow.com/questions/242438/java-performance-of-stringbuilder-in-a-loop