Mozilla.com

Table of contents
  1. 1. Syntax
  2. 2. Description
  3. 3. See Also
Table of contents
  1. 1. Syntax
  2. 2. Description
  3. 3. See Also

Retrieve a pointer to the 16-bit values that make up a given string.

Syntax

jschar * JS_GetStringChars(JSString *str);
Name Type Description
str JSString * String to obtain characters from.

Description

JS_GetStringChars returns a pointer to an array of jschars. Warnings:

  • The array is not necessarily null-terminated. To get the length of the string, use JS_GetStringLength.
  • 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.)

Page last modified 20:01, 5 Sep 2008 by Jorend

Files (0)