Retrieve a pointer to the 16-bit values that make up a given string.
||The string to obtain characters from.|
- The array is not necessarily null-terminated. To get the length of the string, use
- The program must not modify the array. If it does, the behavior is undefined.
- The content of a JS string is not guaranteed to be valid UTF-16. It may contain surrogate code units that aren't properly paired. It may also contain zeroes.
The array returned by this function remains valid as long as
str is valid. (Eventually,
str becomes unreachable, the garbage collector collects it, and the array is freed by the system.)
JS_GetStringCharsZ is the same except that it always returns either a null-terminated string or
NULL, indicating out-of-memory.