'& "在字符串dtaa中 [英] The ' & " in string dtaa

查看:71
本文介绍了'& "在字符串dtaa中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在asp.net项目中,我检索这样的JSON数据:

{... [[...]],'spatialReference':{'wkid':102100}}

当它传递给JavaScript中的变量时,它变为

{d:{... [[...]],\ u0027spatialReference \ u0027:{\ u0027wkid \ u0027:102100}}}

这意味着JavaScript中的变量具有

{d:在开头最后,也改变了'到\ 0000。

我想要的是:

1)在C#中,用'by'代替;

2)在JavaScript中,在数据字符串的末尾截断{d:在开头和}}。

如果你能暗示我该怎么办?谢谢class =h2_lin>解决方案

我已经通过d = d.Replace(',\)解决了Q2;


已解决1)也通过起诉子串函数。感谢。

In an asp.net project, I retrieve the JSON data like that:
{ ... [[ ... ]], 'spatialReference':{'wkid':102100 } }
When it passes to a variabale in JavaScript, it becomes
{"d":"{ ... [[ ... ]],\u0027spatialReference\u0027:{\u0027wkid\u0027:102100}}"}
It means that the variable in JavaScript has
{"d":" in the beginning and "} in the end, and also changes the ' to \u0027.
What I want are:
1) In C#, substitute ' by ";
2) In JavaScript, trauncate {"d":" in the beginning and "} in the end of the data string.
Thanks if you can hint me how to do?

解决方案

I have solved Q2 already by d = d.Replace("'", "\"");


Solved 1) also by suing substring function. Thanks.


这篇关于'& "在字符串dtaa中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆