mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
767 B
33 lines
767 B
=proto
|
|
void duk_join(duk_context *ctx, duk_idx_t count);
|
|
|
|
=stack
|
|
[ ... sep! val1! ...! valN! ] -> [ ... result! ]
|
|
|
|
=summary
|
|
<p>Join zero or more values into a result string with a separator between
|
|
each value. The separator and the input values are automatically coerced
|
|
with
|
|
<a href="http://www.ecma-international.org/ecma-262/5.1/#sec-9.8">ToString()</a>.</p>
|
|
|
|
<p>This primitive minimizes the number of intermediate string interning
|
|
operations and is better than joining strings manually.</p>
|
|
|
|
=example
|
|
duk_push_string(ctx, "; ");
|
|
duk_push_string(ctx, "foo");
|
|
duk_push_int(ctx, 123);
|
|
duk_push_true(ctx);
|
|
duk_join(ctx, 3);
|
|
|
|
printf("result: %s\n", duk_get_string(ctx, -1)); /* "foo; 123; true" */
|
|
duk_pop(ctx);
|
|
|
|
=tags
|
|
string
|
|
|
|
=seealso
|
|
duk_concat
|
|
|
|
=introduced
|
|
1.0.0
|
|
|