遍历List内容截取字符串
Posted assistants
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了遍历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 } 15 list.get(i).setJtzs(Jtzs); 16 } 17 } 18 return list; 19 }
以上是关于遍历List内容截取字符串的主要内容,如果未能解决你的问题,请参考以下文章