name: duk_concat proto: | void duk_concat(duk_context *ctx, duk_idx_t count); stack: | [ ... val1! ...! valN! ] -> [ ... result! ] summary: |
Concatenate zero or more values into a result string. The input values are automatically coerced with ToString().
This primitive minimizes the number of intermediate string interning operations and is better than concatenating strings manually.
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