@Implode (JavaScript)

テキストリストの複数の要素を 1 つのストリングに結合します。

定義場所

@Functions (JavaScript)

構文

@Implode(textList:any) : string

@Implode(textList:any, sep:string) : string

パラメータ 説明
textList 結合するテキストリスト。
sep ストリング内の要素を分割するためのセパレータ。デフォルトはスペースです。
戻り値 説明
string 実行結果のストリング。

使用法

リストは配列として操作します。

以下の例では、スペースを要素のセパレータとして使用し、テキストリストを結合しています。
function p(stuff) {
	print("<<<" + stuff + ">>>"); 
 }

var cities = new Array("Paris", "Berlin", "London", "Moscow");

var citiesString = @Implode(cities);
p(citiesString); // <<<Paris Berlin London Moscow>>>

以下の例では、カンマとスペースを要素のセパレータとして使用し、テキストリストを結合しています。

function p(stuff) {
	print("<<<" + stuff + ">>>"); 
 }

var cities = new Array("Paris", "Berlin", "London", "Moscow");

var citiesString = @Implode(cities, ", ");
p(citiesString); // <<<Paris, Berlin, London, Moscow>>>