how to escape quotes in gremlin queries

匆匆过客 提交于 2019-12-01 05:32:47

Escape the apostrophe using \

So your Gremlin becomes:

:> g.addV('person')
    .property('firstName', 'Anthony O\'Neil')
    .property('lastName', 'Andersen')
    .property('age', 44)

Found out the answer

for encoding use this: encodeURIComponent("Anthony O'Neil").replace(/[!'()*]/g, escape) and the output is: Anthony%20O%27Neil

for decoding use this: decodeURIComponent("Anthony%20O%27Neil") and you will get back Anthony O'Neil

if you just want to escape the single quote use this for encoding: "Anthony O'Neill".replace(/[!'()*]/g, escape) output: Anthony O%27Neill

and the same function above for decoding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!