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.
 
 
 
 
 
 

37 lines
930 B

name: duk_concat
proto: |
void duk_concat(duk_context *ctx, duk_idx_t count);
stack: |
[ ... val1! ...! valN! ] -> [ ... result! ]
summary: |
<p>Concatenate zero or more values into a result string. 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 concatenating strings manually.</p>
<div class="note">
Unlike <code>Array.prototype.concat()</code>, this API call does not
flatten array arguments or support <code>Symbol.isConcatSpreadable</code>.
</div>
example: |
duk_push_string(ctx, "foo");
duk_push_int(ctx, 123);
duk_push_true(ctx);
duk_concat(ctx, 3);
printf("result: %s\n", duk_get_string(ctx, -1)); /* "foo123true" */
duk_pop(ctx);
tags:
- string
seealso:
- duk_join
introduced: 1.0.0