遍历List内容截取字符串
1 /** 2 * 限定指数长度为两位 3 * @return 4 */ 5 public List<BJtzsZoneComeAndCross> subStringJtzsIndex(List<BJtzsZoneComeAndCross> list){ 6 //list不为空 7 String index = ""; 8 String Jtzs = ""; 9 if(list != null && list.size() != 0){ 10 for (int i = 0; i<list.size();i++){ 11 index = list.get(i).getJtzs(); 12 if (index.length() > 4){ 13 Jtzs = index.substring(0,4); 14 }else{
Jtzs = Index;
} 15 list.get(i).setJtzs(Jtzs); 16 } 17 } 18 return list; 19 }
往事如烟,余生有我.