遍歷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 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM