android 字符串拼接

  String transport = listjs.getString("transport");
                                String spStr[] = transport.split(";");
/**
 * 0:飞机,1:火车,2:轮船,3:汽车
 * **/                          String transportstr  = null;
                                StringBuilder sb = new StringBuilder();
                                if(spStr!=null){


                                    for(int i = 0;ilength;i++){
                                         switch (spStr[i]){
                                             case "0" :
                                                 sb.append("飞机 ");
//                                                 transportstr = String.format("飞机");
                                                 break;
                                             case "1":
                                                 sb.append("火车 ");
//                                                 transportstr = String.format("火车");
                                                 break;
                                             case "2":
                                                 sb.append("轮船 ");
//                                                 transportstr = String.format("轮船");
                                                 break;
                                             case "3":
                                                 sb.append("汽车 ");
//                                                 transportstr = String.format("汽车");
                                                 break;
                                         }
                                    }
                                }
                                Log.e("字符串拼接",sb.toString());

你可能感兴趣的:(android 字符串拼接)