1. 程式人生 > >字串中新增逗號 牛逼的寫法

字串中新增逗號 牛逼的寫法

牛逼的寫法  
 String[] hs={"1","2","3","4","5"};   
        StringBuilder sb=new StringBuilder();    
         for(int i=0;i<hs.length;i++){    
             if(i>0)    
                 sb.append(",");    
             sb.append(hs[i]);    
         }  
         System.out.println(sb.toString());