node_api_create_property_key_utf16
napi_status NAPI_CDECL node_api_create_property_key_utf16(napi_env env,
const char16_t* str,
size_t length,
napi_value* result);
-
[in] env
:调用 API 的环境。¥
[in] env
: The environment that the API is invoked under. -
[in] str
:表示 UTF16-LE 编码字符串的字符缓冲区。¥
[in] str
: Character buffer representing a UTF16-LE-encoded string. -
[in] length
:以两字节代码单元表示的字符串长度,如果它以 null 终止,则为NAPI_AUTO_LENGTH
。¥
[in] length
: The length of the string in two-byte code units, orNAPI_AUTO_LENGTH
if it is null-terminated. -
[out] result
:napi_value
代表优化的 JavaScriptstring
,用作对象的属性键。¥
[out] result
: Anapi_value
representing an optimized JavaScriptstring
to be used as a property key for objects.
如果 API 成功,则返回 napi_ok
。
¥Returns napi_ok
if the API succeeded.
此 API 从 UTF16-LE 编码的 C 字符串创建优化的 JavaScript string
值,以用作对象的属性键。复制原生字符串。
¥This API creates an optimized JavaScript string
value from
a UTF16-LE-encoded C string to be used as a property key for objects.
The native string is copied.
JavaScript string
类型在 ECMAScript 语言规范的 第 6.1.4 节 中进行了描述。
¥The JavaScript string
type is described in
Section 6.1.4 of the ECMAScript Language Specification.