遍历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内容截取字符串的主要内容,如果未能解决你的问题,请参考以下文章

sql数据库截取字符串函数

publiccms中将推荐页的内容显示在页面片段中

按指定长度截取字符串

Arduino 中文字符串遍历截取

帝国CMS 列表模板页面 list.var 内容截取

Android 高级UI解密 :PathMeasure截取片段 与 切线(新思路实现轨迹变换)