Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
(clojure.string/join "," '("abc" "def" "ghi") )
std::vector<std::string> x;
std::string y;
const char* const delim = ", ";
switch (x.size())
{
case 0: y = ""; break;
case 1: y = x[0]; break;
default:
std::ostringstream os;
std::copy(x.begin(), x.end() - 1,
std::ostream_iterator<std::string>(os, delim));
os << *x.rbegin();
y = os.str();
}
string y = string.Join(", ", x);
y = x.join(', ');
y = Enum.join(x, ", ")
Y = string:join(X, ",").
write (unit=y,fmt='(*(A,:,", "))') x
String y = x.join(', ')
y = x.join(", ");
String y = x.get(0);
for (int i = 1, n = x.size(); i < n; ++i)
y = y + ", " + x.get(i);
String y = String.join(", ", x);
String y = x.stream()
.reduce((a, b) -> a + ", " + b)
.get();
val y = listOf(x).joinToString(", ")
(defvar y (format nil "~{~A~^, ~}" x))
(setf y (format nil "~{~a~^,~}" x))
(setf y (reduce (lambda (a b)
(concatenate 'string a ", " b))
x))
y = table.concat(x, ", ")
$y = implode(', ', $x);
var
_x: Array of string;
_y: String;
i: Integer;
begin
_y := ''; //initialize result to an empy string
// assume _x is initialized to contain some values
for i := Low(_x) to High(_x) do
begin
_y := _y + _x[i];
if i < High(_x) then _y := _y + ';';
end;
end;
$y = join(", ", @x)
y = ', '.join(map(str, x))
y = ', '.join(x)
y = x.join(", ")
let y = x.join(", ");
val y = x.mkString(",")
(define y
(foldr (lambda (a b)
(if (string=? b "")
a
(string-append a ", " b)))
""
x))
y := x joinSeparatedBy: ', '.
', ' join: #('abc' 'def' 'ghi')
Dim x = {"a", "b", "c", "d"}.ToList
Dim y = String.Join(",", x)