连接数组中的项目

Contents

输出结果

a,b,c


程式码


JavaScript

array = ['a', 'b', 'c'];
console.log(array.join(","));

Perl

my @array = ("a", "b", "c");
print join(",", @array)."\n";

PHP

<?php
$array = ["a", "b", "c"];
print(implode(",", $array)."\n");

Python

array = ["a", "b", "c"]
print(",".join(array))

Ruby

array = ['a', 'b', 'c']
print(array.join(',') + "\n")