1. 程式人生 > >Java字串用逗號拼接

Java字串用逗號拼接

String str = "";
String tn_select = "";
                for(AddTnBean itemBean : list){
                    if(itemBean.isSelect()){str+=(itemBean.getPosition()+1)+",";
                        tn_select = str.substring(0,str.length()-1);}
                }
                if(str.equals("")){}else{
//                    Toast.makeText(mActivity,str,Toast.LENGTH_SHORT).show();
tn_Select= tn_select; }