Public ArrayList getinferfacelist (arraylist<tasknamelist> tasknamelists) {String interfacename= ""; String splitedworktable = ""; ArrayList interfacenamelist =new ArrayList (); Traversal get job Name list of each job name for (Tasknamelist tasknamelist:tasknamelists) {splitedworktable = Tasknamelist.g Ettaskname (); System.out.println ("Job Name:" +splitedworktable); The interface name is the job name minus the prefix spt_gesspsbc-stor_info string[] split = Splitedworktable.split ("_"); Iterate through an array of int to get each element of the split job name for (int x = 1; x < split.length; × x + +) {//first determine if the element is the last if (x = = split.length-1) {//directly splicing element InterfaceName + = Split[x]; } else{//On stitching elements and _ InterfaceName + = Split[x]; SPLIT[1] = Split[1].replace ("-", "_"); InterfaceName + = "_"; }} interfacenamelist.add (InterfaceName); } System.out.println (InterfaceName); return interfacenamelist; }
Source Address: http://blog.csdn.net/sunsiyuan521/article/details/78652481
Java iterates through the array and re-stitching the elements in the array