Obsolete since JSAPI 33
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

This article covers features introduced in SpiderMonkey 1.8.5

Get the characters and the length of a string.


const jschar *
JS_GetStringCharsAndLength(JSContext *cx, JSString *str, size_t *length);
Name Type Description
cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
str JSString * A string to get characters.
length size_t * Out parameter. Receives the length of the string.


JS_GetStringCharsAndLength gets the characters and the length of the string, str

If successful, JS_GetStringCharsAndLength returns a pointer to the string, and store the length to *length, otherwise returns NULL

See also

Document Tags and Contributors

 Contributors to this page: arai, fscholz, ethertank, trevorh, markg
 Last updated by: arai,