NewString returns a string value with given string.
(v string)
| 392 | |
| 393 | // NewString returns a string value with given string. |
| 394 | func (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. |
| 403 | func (ctx *Context) NewStringUTF16(v []uint16) *Value { |
no outgoing calls