clwn.net
当前位置:首页 >> list转为string >>

list转为string

假设你的list变量名是list StringBuffer sb=new StringBuffer(); for(String item:list){ sb.append(item); } // sb.toString() 就是你要的字符串; String[] arr=new String[list.size()]; for(int i=0;i

String abc = "aaa,bbb,ccc"; String[] arr = abc.split(","); List list = java.util.Arrays.aslist(abc);

假设你的list变量名是list StringBuffer sb=new StringBuffer();for(String item:list){sb.append(item);}// sb.toString() 就是你要的字符串;

假设你的list变量名是list StringBuffer sb=new StringBuffer(); for(String item:list){ sb.append(item); } // sb.toString() 就是你要的字符串; String[] arr=new String[list.size()]; for(int i=0;i

import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Test { public static void main(String[] a) { String [] s=new String[] {"1","2"}; List l=new ArrayList(); l=Arrays.asList(s); System.out.pr...

List list = new ArrayList(); //list中添对象 list.add("a"); list.add("b"); list.add("c"); StringBuffer sb = new StringBuffer(); for(String s:list){ sb.append(s) } System.out.println(sb.toString());

调用这个方法 static String[] convert(List from) { ArrayList list = new ArrayList(); for (String[] strings : from) { Collections.addAll(list, strings); } return list.toArray(new String[list.size()]); } 或者是 String [] string = ...

List list = new ArrayList(); String[] strArr = new String[list.size()]; list.toArray(strArr);

假设你的list变量名是list StringBuffer sb=new StringBuffer(); for(String item:list){ sb.append(item); } // sb.toString() 就是你要的字符串; String[] arr=new String[list.size()]; for(int i=0;i

网站首页 | 网站地图
All rights reserved Powered by www.clwn.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com