Create a new JS string.
JSString * JS_NewStringCopyN(JSContext *cx, const char *s, size_t n); JSString * JS_NewUCStringCopyN(JSContext *cx, const char16_t *s, size_t n);
||Pointer to a JS context from which to derive runtime information. Requires request. In a
||Pointer to the array of characters containing the text for the JS string to create.|
||Number of characters to copy from
n characters from a C character array,
s, into the new
JS_NewUCStringCopyN is the Unicode version of the function. The two functions differ only in the type of the character array
If the array
s contains more than
n characters, the new string contains a truncated version of the original string. The string may contain null characters (
'\0'). They are copied into the new string like any other character.
You can use
JS_NewUCStringCopyN return a pointer to the new JS string. Otherwise they return