MCPcopy Create free account
hub / github.com/buke/quickjs-go / NewString

Method NewString

context.go:394–400  ·  view source on GitHub ↗

NewString returns a string value with given string.

(v string)

Source from the content-addressed store, hash-verified

392
393// NewString returns a string value with given string.
394func (ctx *Context) NewString(v string) *Value {
395 var ptr *C.char
396 if len(v) > 0 {
397 ptr = (*C.char)(unsafe.Pointer(unsafe.StringData(v)))
398 }
399 return &Value{ctx: ctx, ref: C.JS_NewStringLen(ctx.ref, ptr, C.size_t(len(v)))}
400}
401
402// NewStringUTF16 returns a string value from UTF-16 code units.
403func (ctx *Context) NewStringUTF16(v []uint16) *Value {

Callers 15

TestContextBasicsFunction · 0.95
TestContextFunctionsFunction · 0.95
TestContextUtilitiesFunction · 0.95
TestContextAsyncFunction · 0.95
TestContextPromiseFunction · 0.95
TestContextTypedArraysFunction · 0.95
TestContextAsyncFunctionFunction · 0.95
TestDeprecatedAPIsFunction · 0.95
TestAtomWithObjectsFunction · 0.95

Calls

no outgoing calls

Tested by 15

TestContextBasicsFunction · 0.76
TestContextFunctionsFunction · 0.76
TestContextUtilitiesFunction · 0.76
TestContextAsyncFunction · 0.76
TestContextPromiseFunction · 0.76
TestContextTypedArraysFunction · 0.76
TestContextAsyncFunctionFunction · 0.76
TestDeprecatedAPIsFunction · 0.76
TestAtomWithObjectsFunction · 0.76