|
|
|
name: duk_decode_string
|
|
|
|
|
|
|
|
proto: |
|
|
|
|
void duk_decode_string(duk_context *ctx, duk_idx_t idx, duk_decode_char_function callback, void *udata);
|
|
|
|
|
|
|
|
stack: |
|
|
|
|
[ ... val! ... ]
|
|
|
|
|
|
|
|
summary: |
|
|
|
|
<p>Process string at <code>idx</code>, calling <code>callback</code> for each codepoint
|
|
|
|
of the string. The callback is given the <code>udata</code> argument and a codepoint.
|
|
|
|
The input string is not modified. If the value is not a string or the index is
|
|
|
|
invalid, throws an error.</p>
|
|
|
|
|
|
|
|
example: |
|
|
|
|
static void decode_char(void *udata, duk_codepoint_t codepoint) {
|
|
|
|
printf("codepoint: %ld\n", (long) codepoint);
|
|
|
|
}
|
|
|
|
|
|
|
|
duk_push_string(ctx, "test_string");
|
|
|
|
duk_decode_string(ctx, -1, decode_char, NULL);
|
|
|
|
|
|
|
|
tags:
|
|
|
|
- string
|
|
|
|
|
|
|
|
seealso:
|
|
|
|
- duk_map_string
|
|
|
|
|
|
|
|
introduced: 1.0.0
|