妙用分隔符分割循环数据
public static void main(String[] args) {String v = "";String f = "";for (int i = 0; i < 4; i++) {v += f + "wwwwwwww" + i;f = "|";}System.out.println(v);}// result : wwwwwwww0|wwwwwwww1|wwwwwwww2|wwwwwwww3?
?
//项目数据movieListData : [#set($flag = "")#foreach( $movie in $movieList) $!flag {"MovieId":"$!{movie.movieid}", //电影id"MovieName" :"$!{movie.moviename}" //电影名称}#set($flag = ",")#end],
?
var flag = "";for(var i = 0; i < passengerInfoArray.length; i++){name += flag + passengerInfoArray[i].split("|")[1];idCard += flag + passengerInfoArray[i].split("|")[3];flag = ",";}
?