天天看點

java周遊連結數組_java周遊數組并重新拼接數組裡的元素

public ArrayList getinferfacelist(ArrayList taskNameLists) {

String interfaceName="";

String splitedWorkTable = "";

ArrayList interfaceNameList =new ArrayList();

//周遊擷取作業名list裡的每個作業名

for(TaskNameList taskNameList:taskNameLists){

splitedWorkTable = taskNameList.getTaskName();

System.out.println("作業名:"+splitedWorkTable);

//接口名就是作業名去掉字首SPT_GESSPSBC-STOR_INFO

String[] split = splitedWorkTable.split("_");

// 周遊int數組,得到拆分作業名的每一個元素

for (int x = 1; x < split.length; x++){

// 先判斷該元素是否為最後一個

if (x == split.length - 1){

// 就直接拼接元素

interfaceName += split[x];

} else{

// 就拼接元素和_

interfaceName += split[x];

//split[1] = split[1].replace("-", "_");

interfaceName += "_";

}

}

interfaceNameList.add(interfaceName);

}

System.out.println(interfaceName);

return interfaceNameList;

}