public static void main(String[] args){ String[] tempStr = {"a","b","c","d","e","f","g","h","i"}; StringBuilder sb = new StringBuilder(); for(String str : tempStr){ if(!(sb.toString().length() <= 0)){ sb.append(","); } sb.append(str); } System.out.println(sb.toString()); }
for循环内StringBuilder字符串拼接
最新推荐文章于 2024-09-04 20:53:49 发布