mozilla

JS_GetStringLength

Return the length, in 16-bit code units, of a JavaScript string.

Syntax

size_t
JS_GetStringLength(JSString *str);
Name Type Description
str JSString * The string to examine.

Description

JS_GetStringLength reports the length, in 16-bit code units, of the string str. This is the same as the length property of the string. This is the same as the length of the array returned by JS_GetStringChars, in char16_ts (not bytes).

Because some Unicode characters are represented using two 16-bit code units, the result is not necessarily the same as the number of Unicode characters in the string.

See Also

Document Tags and Contributors

Contributors to this page: fscholz, Waldo, Jorend, Nickolay, Bzbarsky, MMondor, Tservo, arai
Last updated by: arai,
Hide Sidebar