Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 1.15 KB

File metadata and controls

51 lines (40 loc) · 1.15 KB

String

You are reading a draft of the next documentation and it's in continuous update so if you don't find what you need please refer to: C++ wrapper classes for the ABI-stable C APIs for Node.js

Methods

Constructor

Creates a new String value from a UTF-8 encoded c++ string.

String::New(napi_env env, const std::string& value);
  • [in] env: The napi_env environment in which to construct the Value object.
  • [in] value: The C++ primitive from which to instantiate the Value. value may be any of:
    • std::string&
    • std::u16string&
    • const char*
    • const char16_t*

Creates a new empty String

String::New();

operator std::string

operator std::string() const;

Converts a String value to a UTF-8 encoded C++ string.

operator std::u16string

operator std::u16string() const;

Converts a String value to a UTF-16 encoded C++ string.

Utf8Value

std::string Utf8Value() const;

Converts a String value to a UTF-8 encoded C++ string.

Utf16Value

std::u16string Utf16Value() const;

Converts a String value to a UTF-16 encoded C++ string.