妙用分隔符分割循环数据

阅读更多
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 = ",";
}

 

你可能感兴趣的:(乔乐共享,妙用,分割)