napi_create_string_utf8

Function napi_create_string_utf8 

Source
pub unsafe extern "C" fn napi_create_string_utf8(
    env: napi_env,
    str_: *const c_char,
    length: usize,
    result: *mut napi_value,
) -> napi_status
Available on crate feature napi only.
Expand description

Creates an ArkTS string from a UTF8-encoded C string.

§Arguments

  • env - Current running virtual machine context.

  • str - C string encoded in UTF8 format.

  • length - The length of the C string ‘str’.

  • result - Result of the ArkTS string from the UTF8-encoded C string.

§Returns

  • Returns the function execution status. [napi_ok] If the function executed successfully.

[napi_invalid_arg] If the param env, str and(or) result is nullptr.

Available since API-level: 10