JS::ToString 编辑
This article covers features introduced in SpiderMonkey 31
Convert any JavaScript value to a string.
Syntax
#include "js/Conversions.h" // as of SpiderMonkey 38; previously in jsapi.h
JSString*
JS::ToString(JSContext *cx, JS::HandleValue v)
Name | Type | Description |
---|---|---|
cx | JSContext * | The context in which to perform the conversion. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext . |
v | JS::HandleValue | The value to convert. |
Description
JS::ToString
returns a string representation of a JavaScript value.
If v.isString()
is true
, it calls v.toString()
. Otherwise, it converts the value to string.
On success, JS::ToString
returns a JSString
instance. On error or exception, it returns nullptr
.
See Also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论