概述
函数toString()
将任意对象转换为字符串。
参数:toString(<any>)
<any>
:转换对象(所有类型)
返回值:
- 转换后的字符串(string类型)
- 特别地,转换NODE或EDGE类型的对象时,返回值为点或边的
_uuid
示例
示例图集
在一个空图集中,依次运行以下各行语句创建示例图集:
create().node_schema("professor").node_schema("student")
create().node_property(@*, "age", int32).node_property(@*, "email", string)
insert().into(@professor).nodes([{_id:"P001",_uuid:1,age:53,email:"test@yahoo.cn"},{_id:"P002",_uuid:2,age:27,email:"test@ultipa.com"}])
insert().into(@student).nodes([{_id:"S001",_uuid:3,age:27,email:"test@yeah.net"},{_id:"S002",_uuid:4,age:20,email:"test@w3.org"},{_id:"S003",_uuid:5,age:25,email:"test@gmail.com"}])
一般用法
本例将数字列表转换为字符串:
find().nodes({@student}) as n
with collect(n.age) as ageList
return toString(ageList)
[27,20,25]
列表转换为字符串后,无法再通过下标获取原列表内的元素。
本例将NODE列表转换为字符串:
find().nodes({@student}) as n
with collect(n) as nodeList
return toString(nodeList)
[3,4,5]